# L-25 MCS 275 Wed 17 Mar 2010 : talk_client.py # Illustration of sockets for swapping data # between two clients. The corresponding server # is the script talk_host.py. from socket import * hostname = 'localhost' # on same host number = 11267 # same port number buffer = 80 # size of the buffer server_address = (hostname, number) client = socket(AF_INET, SOCK_STREAM) client.connect(server_address) print 'client is connected' alpha = raw_input('Give message : ') client.send(alpha) print 'client waits for reply' beta = client.recv(buffer) print 'client received \"' + beta + '\"' client.close()