client.py and server.py are a simple example of client/server communication with sockets. This could be run over the internet, but the example below is run on a single machine (named 'thirty-two'). Note that ports 0 - 1023 are "well known", typically with only root access see e.g. http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers 22 ssh 53 dns 80 http 110 pop3 443 https ports 1024 - 49151, can be used by ordinary users 8080 http common alternate 1003 arbitrarily chosen for this example -- server ------------- (start this first in terminal 1) thirty-two:sockets$ python server.py server is listening at ('thirty-two', 10003) connection 1 from ('192.168.1.33', 52131) client sent 'message one sent at Sun Sep 9 17:26:08 2012' client sent 'message two sent at Sun Sep 9 17:26:08 2012' closing connection connection 2 from ('192.168.1.33', 52132) client sent 'message one sent at Sun Sep 9 17:26:09 2012' client sent 'message two sent at Sun Sep 9 17:26:09 2012' closing connection done - saw 2 connections thirty-two:sockets$ -- client ------------- (run this in terminal 2 while server is running) thirty-two:sockets$ python client.py opening connection to ('thirty-two', 10003) sending : message one sent at Sun Sep 9 17:26:08 2012 server sent: client sent 'message one sent at Sun Sep 9 17:26:08 2012' sending : message two sent at Sun Sep 9 17:26:08 2012 server sent: client sent 'message two sent at Sun Sep 9 17:26:08 2012' closing connection thirty-two:sockets$ python client.py opening connection to ('thirty-two', 10003) sending : message one sent at Sun Sep 9 17:26:09 2012 server sent: client sent 'message one sent at Sun Sep 9 17:26:09 2012' sending : message two sent at Sun Sep 9 17:26:09 2012 server sent: client sent 'message two sent at Sun Sep 9 17:26:09 2012' closing connection thirty-two:sockets$