TIdFTPServer - setting data port in passive mode.

Giganews Newsgroups
Subject: TIdFTPServer - setting data port in passive mode.
Posted by:  Norm (no…@itdevel.com)
Date: Tue, 14 Oct 2003

Howdy all,
This is a copy of a post I made to borland.public.delphi.internet.winsock
with no luck. If anyone here can help that would be great!

I have a small problem with Indy 9.0.14 TIdFTPServer using PASV mode.
I wish to explicitly specify a port range for the data channel (due to
server firewall restrictions). I am not quite sure where to hook in
code to set this - in the OnRetrieveFile event ?
Currently I manually add the bindings for the control channel at runtime in
the onshow event
eg:

with myftp.bindings.add do begin
  clientportmin:=9920;
  clientportmax:=9940;
  port:=9921;
end;

I assume the above only applies to the control channel as the ftp
server component insists on assigning the next port available (in the
40000's) for the data channel, which the client then uses to connect
back in and retrieve the file in PASV mode. It also seems to ignore
the defaultdataport setting in the component properties. If I relax
the firewall rules the client can connect back into the server and
program works flawlessly, but this is a production system and security
is a concern.

Any help/hints most appreciated, and congrats to the Indy people on a
great set of components.

Norm.

Replies