"Francesco Bochicchio" <b...@virgilio.it> wrote: > but then, IIRC TCP guarantees that the packet is fully received by > hand-shaking at transport level between sender and receiver. Ad once the > packet is fully in the receiver buffer, why should recv choose to give > back to the application only a piece of it?
This depends a lot on the definition of "package" - At the TCP/IP level, the protocol is quite complex - there are all sorts of info flowing back and forth, telling the transmitter how much space the receiver has available. So your "record" or "package" could be split up... But it gets worse, or better, depending on your point of view: At the ethernet level, a packet is less than 1.5k - so if your record is longer, it can also be split up - OTOH, if it all fits into one ethernet packet, there is every chance that it won't be split up, unless you send a lot of them in a row, without waiting for a response - if you are running something that sends a small request and listens for a small answer, then you will probably never see a record split - but if you run a kind of sliding window protocol that streams a lot of data (even in small packets) then sooner or later one of them will be partly delivered... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list