1. 程式人生 > >客戶端程序

客戶端程序

chan isoc python rom art () imp ddr tar

#!/usr/bin/env python

#

#-*-coding:utf-8-*-

#

from socket import *

HOST = ‘192.168.43.90‘ # // need to change ip

PORT = 6666;

BUFSIZE = 1024;

ADDR=(HOST,PORT)

tcpCliSock = socket(AF_INET,SOCK_STREAM)

tcpCliSock.connect(ADDR)

while True:

  print"socket client start !!"

  data = raw_input (‘>‘)

  if not data:

    break

  tcpCliSock.send(data)

  #data = tcpCliSock.recv(BUFSIZE)

  #if not data:

    #break

  print data

tcpCliSock.close()

客戶端程序