Debugging your network programs is not terribly difficult. WATTCP includes a facility to dump incoming and outbound data, so you can look at the dumps and determine what is happenning at the protocol level.
To enable debugging, call the function dbug_init() prior to calling sock_init() in your program. It has to be called first because it changes the way sock_init works. Also, add the following lines to your TCP.CFG or WATTCP.CFG file:
Then recompile your program and run it, and c:\junk will be filled with the inbound and outbound data.
You may wish to have your program add notes to the debug file. To do so, simply call db_write() with a text string (including CR LF). Such comments in the log file will give you something for which to scan, and can help you sort out your logic compared with the protocol data.