Stupid Q: asyncore and disconnecting?

Fredrik Lundh effbot at telia.com
Thu Oct 5 11:06:37 EDT 2000


Stephen Hansen wrote:
> Okay, I am using asyncore to make a little server, and am wondering how to
> go about detecting a client disconnected?

implement the handle_close method:

    def handle_close(self):
        # do whatever's necessary
        self.close() # nuke the socket

(note that the default implementation prints a log message and closes
the socket for you, so you shouldn't really end up in handle_read more
than once...)

</F>

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->




More information about the Python-list mailing list