In article <[EMAIL PROTECTED]>,
Ron Garret <[EMAIL PROTECTED]> wrote:
> The answer is obvious: select is looking only at the underlying socket,
> and not at the rfile buffers.
Here is conclusive proof that there's a bug in select:
from socket import *
from select import select
s=socket(AF_INET, SOCK_STREAM)
s.bind(('',8080))
s.listen(5)
f = s.accept()[0].makefile()
# Now telnet to port 8080 and enter two lines of random text
f.readline()
select([f],[],[],1)
f.readline()
Here's the sample input:
[EMAIL PROTECTED]:~/devel/sockets]$ telnet localhost 8081
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
123
321
And this is the result:
>>> f.readline()
'123\r\n'
>>> select([f],[],[],1)
# After one second...
([], [], [])
>>> f.readline()
'321\r\n'
>>>
So this is clearly a bug, but surely I'm not the first person to have
encountered this? Is there a known workaround?
rg
--
http://mail.python.org/mailman/listinfo/python-list