[Twisted-Python] How can ftpclient.py work?

John Goerzen jgoerzen at complete.org
Sat Jul 26 21:28:53 EDT 2003


I've been reading over the Twisted examples to learn the system and
one of them, ftpclient.py, has me flummoxed.  Specifically, the
connectionMade function near the end.

It issues a number of commands right in a row, without waiting for the
results to come back from the deferreds that they return.  To me this
seems bad because:

1. The system would have no way of knowing which command a particular
   response belongs to

2. Sending additional commands before the server is done with the
   first one may cause problems (for instance, if it takes a little
   while to fully transmit the first command, the second one could be
   transmitted in the middle)

3. There is no error-checking in there, so commands are issued that
   are dependant on the success of earlier ones (rnuning nlst after
   cdup, for instance), but they're issued potentially before the
   earlier ones have a chance to return an error.

Now, I'm assuming that these problems do not actually exist.  Yet I
cannot work out why not.  Can anybody shed some light?


More information about the Twisted-Python mailing list