donn at u.washington.edu
Mon Sep 18 19:19:19 CEST 2000
Quoth Ulf Engström <ulf.engstrom at b2b-link.com>:
| As a part of 'gettting-closer-to-one-question-about-timeout-a-day' I have
| another question about select.
| As there's no timeout in socket I'm using select.select to determine if
| there's something waiting on the socket before I read it.
| This has worked great up 'til now when I after a few calls (There's a lot of
| calls to this function, should that be a problem?) it returns that there's
| something on that socket, but when I read it all I get is ''. And then the
| socket is completely dead, returning '' on every recv call.
| Is this due to a "socket-error" and I would just have to reestablish it or
| is it something else? Is there a reason that this happens after multiple
| calls to select?
Yes, it's due to a socket error, though it could be the very normal error
of having just closed. When a socket has been closed on the other end,
recv() returns ''. select's job is to let you know when a read on the
device will return and not block, so it has to return that descriptor.
When you notice the '', you can close your end, and remove that socket
from the list of sockets to select on, because it's dead.
| When I try to reestablish the socket when I get the error I still only get
| '' on it.
What do you do to reestablish a socket? I think once a socket has been
closed on either end, it's kaput.
Donn Cave, donn at u.washington.edu
More information about the Python-list