Tcp Socket Receive

specx at mynet.com specx at mynet.com
Sat Apr 1 10:36:29 EDT 2017


Hello,
 
I have a tcp server coded with python and my packets include a 2 bytes header which is just the length of the following data. The problem is how can I be sure I received 2 bytes and not just one byte. In Qt, I use bytesAvailable function. However, here I just use sock.recv(2) but it can fetch less than 2 since the parameter is the maximum length. Do we have any method?
 
Greetz




More information about the Python-list mailing list