-----Original Message----- From: twisted-python-bounces@twistedmatrix.com [mailto:twisted-python-bounces@twistedmatrix.com] On Behalf Of Jean-Paul Calderone Sent: Friday, October 19, 2007 5:07 PM To: Twisted general discussion Subject: RE: [Twisted-Python] Need some help with my first Twisted program
On Fri, 19 Oct 2007 16:53:00 -0400, "McCann, Brian"
wrote: [snip]
def openShell(self, trans): ep = EchoProtocol() ep.makeConnection(trans) trans.makeConnection(session.wrapProtocol(ep))
def eofReceived(self): pass
def closed(self): pass
Here, you implemented connection set up, invoking makeConnection on the protocol you instantiated. However, you didn't do anything similar for connectionLost. You may want to keep a list of the protocol instances openShell creates and give them disconnection notification in closed (which is being called in this example).
Jean-Paul
I'm trying various things to do what you suggest, but the Twisted API docs are hard for me to follow sometimes. I tried making "eofReceived" and "closed" just print a debug line (after calling my "connectionLost function didn't appear to do anything), and neither appeared to fire when I closed the ssh client. I tried looking up other examples I could possibly follow on the net, but came up only with the same examples that are on the Twisted site. I can't even figure out where "trans" comes from or what it is :( . Could you point me in the direction of a better example? I assumed that I could find what I needed if I dug hard enough in the API docs, but I just kept reaching dead ends. Thanks for all your help! --Brian