written improvement on ftplib.FTP(); relevant questions

B

Beeyah

in my inability to find a working ftp program for my mac, i decided to
write one in python. i wrote a class (link at end of post) that
inherited ftplib.FTP and made the process slightly less involved, but
it brought up a few questions:

using the sendcmd() method to do a simple "LIST" command returns an
error explaining that a data connection could not be opened, just as
if you connected to a ftp server using telnet. so, you use the method
retrlines() with "LIST", and everything's fine. the whole module, in
my opinion, seems like a piece of work. every method gives the
appearance of a workaround. i get the impression it would be
enormously easier to manipulate and comprehend if you simply wrote it
on your own with sockets.

so what i'm saying is i want to write my own ftp class, but i don't
know how to handle the two seperate data/command sockets. i started to
read the rfc, but i'm so sick of those things lately. if it isn't a
simple explanation, could someone point me to an appropriate document,
or the relevant page of the rfc, that will explain the process of the
command connection versus the data connection in general programatic
terms? I'd appreciate that.

anyway, if anyone's interested, i'll link to the class i wrote. it
uses a queue to store messages from the server and general program
messages, with the intention of having a seperate thread to sit and
interpret/output. in addition, the class is intentionally completely
detached from the fate of the program, that way it could be more
universal. with that in mind, when something fatal involving the
connection has occured, it pushes a simple "exit" string to the queue
-- one that could be changed to a numeric representation of an error
message or whatever, to be "interpreted" so to speak. its right here:

http://216.67.238.18/~bar/misc/BetterFTP.py

Beeyah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top