Here's some sample code I've done to help others get started with TCP sockets.