[Gambas-user] Problems working with FTPClient

Tobias Boege taboege at ...626...
Sun Feb 17 14:31:26 CET 2013


On Sun, 17 Feb 2013, Beno?t Minisini wrote:
> Le 17/02/2013 12:27, Tobias Boege a ?crit :
> >> In revision #5554, I changed the behaviour of the Read event so that it
> >> is raised while there is something to read by any i/o instruction. Now
> >> Line Input can be used as expected!
> >>
> >
> > Can confirm this.
> >
> > Are there any plans for the passive mode problem? I didn't get it working
> > locally but I don't know libcurl.
> >
> > Thanks,
> > Tobi
> >
> 
> I don't know what you are talking about. According to the libcurl doc, 
> curl runs in passive mode by default, and manage it automatically.
> 

Doing FtpClient.Exec(["LIST"]), the FTP server errors at me that I have to
"use PASV or PORT first". In this case, curl does not (and cannot) know
that we want a passive transfer because we initiate the operation manually
using Exec().

FtpClient.Exec(["PASV", "LIST"]) is not better since this opens a passive
port on the server side to send the LIST command output but curl is not
aware of this port because we, again, did it manually. Hence we cannot
receive data from it.

It's not a problem with LIST in particular because this can be emulated but
there are other commands which require this mode of operation.

Basically, I came into this misery because the FtpClient doesn't have a full
FTP interface. The whole idea behind Exec() seems to be that the user should
implement the commands the FtpClient lacks currently themselves:

I could imagine Scan$()ing the server response from a PASV command and
opening a normal Socket because it only needs to read once connected. The
PASV response line looks like

227 Entering Passive Mode (208,118,235,20,109,227).

(obtained via telnet) but this line is not available to a Gambas program
either. You can see it with FtpClient.Debug = True but not access it with
Gambas.

This makes it impossible to capture the FTP responses and implement the
missing stuff by hand. Do we agree up to this point?

Thinking about it further, the FtpClient as it is now (using plain FTP
without ssh or other security measures) can easily be implemented in Gambas
alone. It is simply passing around strings over the network. It only needs a
Socket or two and the Print instruction.

Regards,
Tobi




More information about the User mailing list