|Subject:||Re: TIdFTPServer - setting data port in passive mode.|
|Posted by:||Remy Lebeau (TeamB) (firstname.lastname@example.org)|
|Date:||Tue, 14 Oct 2003|
"Norm" <no…@itdevel.com> wrote in message
> 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 ?
TIdFTPServer does not support port ranges for the data channel. It is
always assigned to a specific port. During a PASV transfer, that port is
specified by the main DefaultDataPort property. For a non-PASV transfer,
that port is specified by the client's PORT command.
> Currently I manually add the bindings for the control
> channel at runtime in the onshow event
That will not work. TIdFTPServer uses a separate TIdSimpleServer for its
data channel in PASV mode. You need to specify the port for that server,
not the main TIdFTPServer itself. However, you do not have any access to
that TIdSimpleServer at all. Instead, its listening port is set to whatever
the TIdFTPServer::DefaultDataPort property is set to at the time the data
channel is created.
> 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
Not true. The default data channel port is 20, and is not based on the
command channel's port at all.
> It also seems to ignore the defaultdataport setting in
> the component properties.
No, it it not ignored, it actually is used.
TIdFTPServer - setting data port in passive mode. posted by Norm on Tue, 14 Oct 2003