# python client

import sys 
from socket import * 

serverHost = 'localhost'
serverPort = 2000

s = socket(AF_INET, SOCK_STREAM) #create a TCP socket 
s.connect((serverHost, serverPort)) # connect to server on the port 

message = 'Hello world';

while True:

    s.send(message) #send the data 
    data = s.recv(1024) #receive up to 1K bytes 
    print "I received the message:", data 

    if message == 'quit': # to quit the server, too
        break

    if message == 'q': # just quits the client
        break

    message = raw_input("Type a string to send: ")


print 'Good bye!'

