poll() on a linux box always returns POLLIN
ab
ajb at spkypc.demon.co.uk
Tue Nov 27 09:07:49 EST 2001
Hey,
Just trying out some asynchronous socket operations in python,
simple client server test code.
Anyway so I get a queue of threads going waiting to be passed sockets.
When they get a socket, I am using poll to implement timeouts. However
poll() always seems to return data ready POLLIN, even when client has
disconnected and finished. when reading the socket, 0 bytes of data is
returned, as you would expect with the peer disconnected ???
any thoughts ???
sample code:
while 1:
result = poller.poll(5000)
print result
if result == []:
break
fd,event = result[0]
if event == select.POLLIN:
print 'receiving'
str = conn.recv(1024)
print len(str)
print str
else:
break
More information about the Python-list
mailing list