It has to be Python Don’t ask. http://docs.python.org/howto/sockets.html, the official python documentation site http://www.kellbot.com/2010/02/tutorial-writing-a-tcp-server-in-python/, a rather wonderful tutorial http://doc.astro-wise.org/socket.html, more but harder to understand, for me at least and http://www.evolt.org/node/60276 which has slightly different flow control,
Read morePython and datetime
Some notes on python and its datetime routines.
Read more