Re: select.select and socket.setblocking
- From: Francesco Bochicchio <bockman@xxxxxxxxxxx>
- Date: Wed, 31 Dec 2008 11:39:32 +0100
Francesco Bochicchio ha scritto:
No, in blocking mode it will wait to receive _some_ data (1 or
more bytes). The "requested" amount is strictly an upper
limit: recv won't return more than the requested number of
bytes, but it might return less.
Uhm. In my experience, with TCP protocol recv only returned less than the required bytes if the remote end disconnects. I always check the
returned value of recv and signal an error if the read bytes are less than the expected ones, but this error is never occurred (and its about 20 years that I use sockets in various languages and various flavor of unix and occasionally on windows. Maybe have always been lucky ? :-)
BTW, this is not a rethorical or ironic question... my applications mostly run on LANs or dedicated WANs so maybe they never experienced the
kind of network congestion that could cause recv to return less than the expected amount of bytes ...
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?
Ciao
-----
FB
.
- References:
- select.select and socket.setblocking
- From: Laszlo Nagy
- Re: select.select and socket.setblocking
- From: Francesco Bochicchio
- Re: select.select and socket.setblocking
- From: Grant Edwards
- Re: select.select and socket.setblocking
- From: Francesco Bochicchio
- select.select and socket.setblocking
- Prev by Date: SDC lite
- Next by Date: Re: Easy-to-use Python GUI
- Previous by thread: Re: select.select and socket.setblocking
- Next by thread: Re: select.select and socket.setblocking
- Index(es):
Relevant Pages
|