Just a general tip for all who want to do network programming: Install wireshark and learn how to use it. It allows you to monitor your network traffic with great detail.

During my computer networks course at university, I had to do some programming assignments and wireshark helped me ALOT there.