[Twisted-Python] How to setup a ftpserver, ftpclient?

Andrew Bennetts andrew-twisted at puzzling.org
Mon Apr 8 21:04:14 MDT 2002


*sigh* Replying to myself again...

While we're on the topic of FTP, I was wondering if there's any reason
why I shouldn't use a single listening socket per FTPClient for active
transfers?

Currently, for each active transfer, it opens a new FTPDataPort to
accept the connection, which ends out being quite icky due to the
sequencing of events.  I've realised that because I don't pipeline FTP
commands in the client (because it's tricky to do right and some servers
can't do it anyway), there's no ambiguity with re-using the same
FTPDataPort over and over...

The only downside should be that all the hard work Glyph and Itamar put
into tracking down the connectionLost from inside tcp.doRead bug for me
will now be unnecessary ;)

If you're wondering, I think it would make the code *alot* cleaner.
Especially in .retrieve and .generatePortCommand, which do messy things
with Deferreds.  I just want to convince myself that it's a perfectly
safe change that won't break anything before I do it.

-Andrew.





More information about the Twisted-Python mailing list