timo at alum.mit.edu
Tue Aug 27 06:28:16 CEST 2002
Most often, you should NOT set the socket to
non-blocking when using select.select()
for simple timeout mechanisms with sockets. Look
forward to Python 2.3, where these timeouts will be
brueckd at tbye.com wrote:
> On Mon, 26 Aug 2002, Greg Ewing wrote:
> > > # Set nonblocking and initialize data.
> > > self.request.setblocking(0)
> > You shouldn't be making the socket non-blocking. Select
> > will return immediately for a non-blocking socket,
> > whether there's data there or not.
> I don't think this is true. This code:
> import select
> from socket import *
> s = socket(AF_INET, SOCK_STREAM)
> s.connect(('www.google.com', 80))
> pauses for one second before returning on both my Linux box and my WinXP
> P.S. Thanks for making Pyrex!
More information about the Python-list