For a start you should wrap receiving in a try ... except because recv() will 
raise an exception on timeout or error which might tell you valuable 
information. Looking at `rd` might also be helpful as it's the return value of 
the "deeper" basic recv() (called by the "comfort" recv() version you call).

Finally also keep in mind the intricacies of sockets also in the operating 
systems and implementations some of which, to provide an example, return a 
timeout or error if less than the specified read size bytes are available, i.e. 
if you try to get 1000 bytes and 999 are available you may not get those 999 
but rather an error or timeout.

In tough cases ltrace or strace can be very helpful and valuable.

Reply via email to