Bryan Olson wrote:
> There are cases where a socket can select() as readable, but not be
> readable by the time of a following recv() or accept() call. All such
> cases with which I'm familiar call for a non-blocking socket.
I used to believe that if select() said data was ready for reading, a
Bryan Olson wrote:
>
>Where does this come up? Suppose that to take advantage of multi-core
>processors, our server runs as four processes, each with a single thread
>that responds to events via select(). Clients all connect to the same
>server port, so the socket listening on that port is sh
Laszlo Nagy wrote:
[...]
I have read the socket programming howto (
http://docs.python.org/howto/sockets.html#sockets ) but it does not
explain how a blocking socket + select is different from a non blocking
socket + select. Is there any difference?
There is, but it may not effect you. There ar
Can you post an example program that exhibits the behavior you
describe?
I was forgetting about the MSG_WAITALL flag ...
When I started programming with sockets, it was on a platform (IIRC
Solaris) that by default behaved like MSG_WAITALL was set by default
(actually, I don't remember it be
"Francesco Bochicchio" 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?
T
Saju Pillai ha scritto:
On Dec 31, 7:48 pm, Francesco Bochicchio wrote:
Is this correct ? IIRC even in blocking mode recv() can return with
less bytes than requested, unless the MSG_WAITALL flag is supplied.
Blocking mode only guarantees that recv() will wait for a message if
none is available
Jean-Paul Calderone wrote:
...
On a LAN, it's likely that you'll generally get the exact number of bytes
which the sender passed to one call of send (until the sender starts to
pass really huge strings to send, then it'll get split up) just because
the network has lots of capacity compared to the
On 2008-12-31, Francesco Bochicchio wrote:
> Grant Edwards ha scritto:
>> On 2008-12-30, Francesco Bochicchio wrote:
>>
>>> 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
>>> select between blocking and non-blocking mode. The difference is in the
>>> recv (again, assumin
On Wed, 31 Dec 2008 15:48:50 +0100, Francesco Bochicchio
wrote:
< ... >
Uhm. In my experience, with TCP protocol recv only returned less than
the required bytes if the remote end disconnects. I always check the
What if the sending end actually sent less than you asked for ?
-srp
In blocki
On Wed, Dec 31, 2008 at 5:39 AM, Francesco Bochicchio
wrote:
> 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
>>> b
On Dec 31, 7:48 pm, Francesco Bochicchio wrote:
> < ... >
>
> >> Uhm. In my experience, with TCP protocol recv only returned less than
> >> the required bytes if the remote end disconnects. I always check the
>
> > What if the sending end actually sent less than you asked for ?
>
> > -srp
>
> In b
< ... >
Uhm. In my experience, with TCP protocol recv only returned less than
the required bytes if the remote end disconnects. I always check the
What if the sending end actually sent less than you asked for ?
-srp
In blocking mode and with TCP protocol, the recv waits until more bytes
a
On Dec 31, 2:01 pm, Francesco Bochicchio wrote:
> Grant Edwards ha scritto:
>
> > On 2008-12-30, Francesco Bochicchio wrote:
>
> >> 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
> >> select between blocking and non-blocking mode. The difference is in the
> >> recv (again,
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 o
Jean-Paul Calderone ha scritto:
On Tue, 30 Dec 2008 19:19:08 +0100, Francesco Bochicchio
wrote:
[snip]
If you are interested in socket errors, you should
also fill the third 'fd-set' in the select call, and after select
returns check that fd is not in it anymore:
ready = select.select( [fd]
Grant Edwards ha scritto:
On 2008-12-30, Francesco Bochicchio wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The difference is in the
recv (again, assuming that you use TCP as protocol, that is AF_INET,
SOCK_STREAM)
On Tue, 30 Dec 2008 15:55:51 -0500, Jean-Paul Calderone
wrote:
On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards wrote:
On 2008-12-30, Francesco Bochicchio wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The differ
On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards wrote:
On 2008-12-30, Francesco Bochicchio wrote:
3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
select between blocking and non-blocking mode. The difference is in the
recv (again, assuming that you use TCP as protocol
On 2008-12-30, Francesco Bochicchio wrote:
> 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in
> select between blocking and non-blocking mode. The difference is in the
> recv (again, assuming that you use TCP as protocol, that is AF_INET,
> SOCK_STREAM), which in the block
On Tue, 30 Dec 2008 19:19:08 +0100, Francesco Bochicchio
wrote:
[snip]
If you are interested in socket errors, you should
also fill the third 'fd-set' in the select call, and after select returns
check that fd is not in it anymore:
ready = select.select( [fd],[], [fd] )
if fd in ready[2]:
Laszlo Nagy ha scritto:
I'm using this method to read from a socket:
def read_data(self,size):
"""Read data from connection until a given size."""
res = ""
fd = self.socket.fileno()
while not self.stop_requested.isSet():
remaining = size - len(res)
Laszlo Nagy wrote:
> I'm using this method to read from a socket:
>
>def read_data(self,size):
>"""Read data from connection until a given size."""
>res = ""
>fd = self.socket.fileno()
>while not self.stop_requested.isSet():
>remaining = size - len(r
22 matches
Mail list logo