Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: select.select and socket.setblocking

Reply
Thread Tools

Re: select.select and socket.setblocking

 
 
Jean-Paul Calderone
Guest
Posts: n/a
 
      12-30-2008
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]:
> # raise your error here


The third argument to select() isn't for monitoring sockets for errors. Its
behavior is also rather platform sensitive. In general, you don't need it
at all on POSIX, but on Windows you should pass the same list for it as you
pass for the write-set, merge the results, and treat them all as writeable.

Or use a higher-level library that deals with all the asinine details for
you.

Jean-Paul
 
Reply With Quote
 
 
 
 
Francesco Bochicchio
Guest
Posts: n/a
 
      12-31-2008
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],[], [fd] )
>> if fd in ready[2]:
>> # raise your error here

>
> The third argument to select() isn't for monitoring sockets for errors.
> Its
> behavior is also rather platform sensitive. In general, you don't need it
> at all on POSIX, but on Windows you should pass the same list for it as you
> pass for the write-set, merge the results, and treat them all as writeable.
>
> Or use a higher-level library that deals with all the asinine details for
> you.
>
> Jean-Paul


Yes, now that you mention it I remember having to do something like that
on a socket library I wrote on windows ... IIRC, the send could not
complete and then signal the readyness of the socket through
the third argument of the select ...

My experience is mostly on unices, and I usually don't use the third
argument (and not often the second) but I remember having read on
select manual page that it was for errors. Now both python manuals
than select manual page say it is for 'exceptional conditions', without
going into details ...

Tx for the clarification, anyway ...

Ciao
----
FB
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57