I'm not sure exactly what is wrong but I think you need a different architecture for your tcp server code on the robot. We were able to get things working using the examples on this website:
http://beej.us/guide/bgnet/
In particular, our "server" code uses 'select' to see if any of the clients have anything to say. We can then "poll" rather than putting our robot code inside of an infinite loop like you're having to do. This page has some information on using 'select':
http://beej.us/guide/bgnet/output/ht...ed.html#select
Using this, our server code was all inside a function call rather than the other way around and we didn't have to spawn any tasks.
Hope this helps!