select.select question

brueckd at tbye.com brueckd at tbye.com
Mon Aug 26 17:10:01 CEST 2002


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))
s.setblocking(0)
select.select([s],[],[],1.0)

pauses for one second before returning on both my Linux box and my WinXP 
box.

-Dave

P.S. Thanks for making Pyrex!





More information about the Python-list mailing list