# Echo client program # sends a message to a server and receives a reply import socket HOST = '' # The remote host PORT = 50007 # The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) # connect to the server using the server's host and port s.send('Hello, world') # send a message to the server data = s.recv(1024) # recieve up to 1024 bytes of data s.close() # close the connection to the server print 'Received', repr(data)