<div dir="ltr">Thanks. <div><br></div><div>So is the idiomatic approach for this with something like the FTPClient to subclass it and override connectionLost? FTPClientBasic clears up queued commands when this happens (which I assume I still want it to do). <div>
<br></div><div>To me it seems a little overbearing to have to subclass the ftpclient just to get a tcp connection lost event (which seem like an event most users would be interested in).<br><div><br></div><div><br><div><br>
</div><div><br></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 5, 2013 at 1:35 PM,  <span dir="ltr"><<a href="mailto:exarkun@twistedmatrix.com" target="_blank">exarkun@twistedmatrix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 05:49 pm, <a href="mailto:peter@peterryan.net" target="_blank">peter@peterryan.net</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am writing a simple ftp client which I am trying to dispose of. Right now<br>
I send a quit command:<br>
<br>
(the ftp_client reference is a FTPClient built with a ClientCreator)<br>
<br>
deferred = ftp_client.quit()<br>
<br>
And I register a callback:<br>
<br>
def quitSent(response):<br>
  print "quit acknowledged...connected?", ftp_client.transport.connected<br>
<br>
deferred.addCallback(quitSent)<br>
<br>
If I invoke the above the connection is printed as connected.<br>
</blockquote>
<br></div>
There is no documented `connected` attribute of transports.  So who knows what this is telling you. :)<br>
<br>
However, the way you learn when a protocol's transport has disconnected is to implement the `connectionLost` method on the protocol.  It is called when the transport disconnects.<br>
<br>
Jean-Paul<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
However if I schedule a callback to check the status later:<br>
<br>
def status():<br>
  print "quit acknowledged...connected?", ftp_client.transport.connected<br>
<br>
reactor.callLater(1, self.status)<br>
<br>
If I schedule a callback for a second later the transport is not connected.<br>
I've searched quite a bit but I cannot determine a way to register a<br>
callback for when the TCP transport is actually disconnected. Can anyone<br>
offer some insight? I'd like to know explicitly when the client is closed.<br>
<br>
Thanks,<br>
<br>
Peter<br>
</blockquote>
<br></div>
______________________________<u></u>_________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.<u></u>com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-<u></u>bin/mailman/listinfo/twisted-<u></u>python</a><br>
</blockquote></div><br></div>