In response to the FEAT request, some servers just return "PROT" and the current test for PROT P will always fail. This is the minor change I have made to the FTP Client. It would be nice if this could be added so I don't have to modify the source after each update:

Change this:

                if Pos('PROT', Feat) = 1 then begin
                    if Feat = 'PROT' then
                        FSupportedExtensions := FSupportedExtensions + [ftpFeatProt];
                    if Pos('C', Feat) > 5 then
                        FSupportedExtensions := FSupportedExtensions + [ftpFeatProtC];
                    if (Pos('P', Feat) > 5) then
                        FSupportedExtensions := FSupportedExtensions + [ftpFeatProtP];
                end;

to this:

Define tempFeat at start of ControlSocketDataAvailable
Add ftpFeatProt to TFtpExtension

                if Pos('PROT', Feat) = 1 then
                begin
                  tempFeat := Feat;
                  Delete (tempFeat, 1, 4); //Just leave any parameters

                  if Length (tempFeat) = 0 then //It was just "PROT"
                  begin
                    FSupportedExtensions := FSupportedExtensions + [ftpFeatProt];
                  end
                  else
                  begin
                    if Pos('C', tempFeat) > 0 then
                      FSupportedExtensions := FSupportedExtensions + [ftpFeatProtC];

                    if Pos('P', tempFeat) > 0 then
                      FSupportedExtensions := FSupportedExtensions + [ftpFeatProtP];
                  end;
                end;

Regards
Graham

On 11/02/2018 21:16, Graham Powell wrote:
Thank you once again for your help. You are indeed correct. A search on the Internet suggests the timeout could be between 30 and 120 seconds.

When I have finished all my testing, I show you what I have modified in the SslFtpClient. Just a simple change to the processing of the FEAT response regarding PROT. Some servers just return PROT and the current detection of PROT P will always fail.

Regards
Graham

On 11/02/2018 14:40, Angus Robertson - Magenta Systems Ltd wrote:
I have set Active Mode and the Data Port Range to 10000..10010
I connect to the Demo Server and click on the "Get" button.
I have a breakpoint where the Data Port number is allocated so I
can see it increment through the above range.
When it gets to 10010 it loops back to 10000.
The next click on the "Get" button fails with the error that this
port (10000) is in use.
This is standard windows behaviour, established ports do not close
instantly you close a connection, they go into time_wait state for
about 60 seconds in case packets are still floating around.

So you probably clicked past your range of 10 in one minute or so.
Just make the range 100 or 1,000.

Finding some users ports (1,024 up) in use is inevitable because so
many applications use them for internal purposes, so you need to always
retry failed connection, repeatedly.  Also better to choose an obscure
range that others are less likely to be using than around 10,000.

Which is exactly why many people use my TMagFtp component, all this
stuff is long known and handled.
  Angus



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to