Very simple client and server in Python taken from TutorialsPoint.com Python tutorial at http://www.tutorialspoint.com/python/python_networking.htm
Now run this server.py in background and then run above client.py to see the result.
$ python server.py &
$ python client.py
This would produce following result:
Got connection from ('127.0.0.1', 48437) Thank you for connecting