from socket import * HOST = 'localhost' # the remote host name PORT = 50007 # same port used by the server s = socket(AF_INET, SOCK_STREAM) s.connect((HOST, PORT)) s.send('Hello, world') data = s.recv(1024) s.close() print 'Received', `data`