UDP sockets
Peter Hansen
peter at engcorp.com
Wed Oct 22 09:35:18 EDT 2003
Wojtek Walczak wrote:
>
> Dnia 22 Oct 2003 11:15:35 +0200, Zunbeltz Izaola napisa³(a):
>
> > I'm porting a client writen in C++ to python. What is the way to get a
> > timeout in an select for one socket?
>
> Quote from the ,,7.3 select -- Waiting for I/O completion'':
>
> The optional timeout argument specifies a time-out as a floating point
> number in seconds.
>
> So, it'll be something like this:
>
> n = select.select([fds], [], [], 2)[0][0]
At first glance, this appears unsafe. What if the fds socket
is not ready after the timeout?
You will, I think, get an IndexError raised.
-Peter
More information about the Python-list
mailing list