while True: print 'waiting for connection...' clientsock,addr = server_sock.accept() print 'received from :',addr
while True: data = clientsock.recv(bufsize) print ' 收到---->%s\n%s' %(ctime(),data) data = raw_input("发送----->") clientsock.send(data) clientsock.close()
while True: data = raw_input("发送---->") if not data: break else: client_sock.send(data) data = client_sock.recv(bufsize) print '收到---->%s\n%s' %(ctime(),data)