On Sun, 22 Apr 2007 11:42:10 -0700, Ron Garret <[EMAIL PROTECTED]> wrote: >I think I've figured out what's going on. > > [snip] > >As you can see, the select call shows input available for a while (five >lines) and then shows no input available despite the fact that there is >manifestly still input available. > >The answer is obvious: select is looking only at the underlying socket, >and not at the rfile buffers. > >So... is this a bug in select? Or a bug in my code?
In your code, unfortunately. select() is for file descriptors, not arbitrary buffering Python file objects. You shouldn't use readline if you want select to work right, and vice versa. Use read() and do your own line buffering (it's trivial) or don't use select (which I believe has been suggested, and I can't tell from your code why you want to use select in the first place). Or avoid the low-level networking entirely and use a high-level HTTP library that takes care of these details for you. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list