asyncore/asynchat

F.G.Testa testa at allos.sytes.net
Fri Nov 14 14:43:56 EST 2003


Hi!
Is there a way to access a specific connected socket when using a derived
asyncore.dispatcher and derived asynchat.async_chat?

class AcmeServer(asyncore.dispatcher):
    def __init__(self, port):
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.bind(("", port))
        self.listen(5)

    def handle_accept(self):
        conn, addr = self.accept()
        AcmeChannel(self, conn, addr)

 def handle_close(self):
  print 'Server closed'

 def handle_error(self):
  print 'Server error'

How do I access the underlying list/map/array of AcmeChannel?
Thank you.








More information about the Python-list mailing list