asynchat network send problems

Scott David Daniels scott.daniels at
Thu Mar 2 19:12:25 CET 2006

Andreas R. wrote:
> 4. In the found_terminator() method, the data is attempted to be 
> uncompressed, but it failes, since the received data does not have the 
> same size as the data which is sent. Sometimes, the difference in size 
> is often 512 between client and server, when running len(packet) on the 
> *compressed* packed. The len() of a large packet is usually about 64969.

Just a guess, but do you know "send" and "receive" are not guaranteed to
send all bytes or receive all bytes?  The network itself is allowed to
re-pack packets at any point in the path, and delays may happen at any
packet boundary (including those boundaries created by the network).
You need to do something like "sendall" and your receiver needs to know
when it needs to wait for more data (as a matter of protocol design).

-Scott David Daniels
scott.daniels at

More information about the Python-list mailing list