[fpc-pascal] Getting strange FTP error using Indy 10 idFTP

Bo Berglund bo.berglund at gmail.com
Thu Nov 23 00:09:36 CET 2017


On Wed, 22 Nov 2017 14:11:08 -0600, Zoƫ Peterson
<zoe at scootersoftware.com> wrote:

>On 11/22/2017 1:50 PM, Bo Berglund wrote:
>> 20:14:01.018 EXCEPTION: Invalid PORT Command.
>
>Set FTP.Passive := True.  PORT is used for active connections, where the 
>server opens a connection to the client computer for the data stream. 
>PASV is used for passive connections, where the client opens a second 
>connection to the server.
>
>https://stackoverflow.com/questions/1699145/what-is-the-difference-between-active-and-passive-ftp#1699163

Thanks!
That did the trick!
I was looking down the Windows Firewall settings to see if something
there blocked the communications...

It turned out that the old code *had* an FTP.Passive := true;
statement hidden away where I did not notice..

And my code for retrieving the list was also incorrect, I needed
FTP.Listresult for that.

Question:
---------
The result off of this Windows server looks very much like a Linux ls
-l command result:

-rwxrwxrwx   1 owner    group            1572 Sep 28 15:30
Config_2017-09-28.zip
drwxrwxrwx   1 owner    group               0 Nov 13 19:30 AGIENG
drwxrwxrwx   1 owner    group               0 Nov 22  1:05 CVSREPOS
drwxrwxrwx   1 owner    group               0 Nov 11 15:44 FULLREPO

Is this how it always looks like or is there a way to format the list
into something less Linux-ish?

I need to get a list of the files that match a specific format like:
<name>_<date>.zip
I could of course traverse the supplied TStrings and look at the first
char (discard all d entries) and check if the last part is .zip.
But it would be a lot easier if the list could be limited to the
filenames only.

The FTP.List() command has a number of overloaded versions and I have
yet to find a working documentation of these. So in the absence of
Remy Lebeau I am hard pressed to figure it out. And tracing down the
Indy sources is not an easy task.
Maybe one of them will produce a simple file list only?


-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list