Re: TIdFTPServer - setting data port in passive mode.

Giganews Newsgroups
Subject: Re: TIdFTPServer - setting data port in passive mode.
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Tue, 14 Oct 2003

"Norm" <no…@itdevel.com> wrote in message
news:424B44BD8582E240no…@itdevel.com...

> 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

Correct.

> 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.

Gambit

Replies

In response to

TIdFTPServer - setting data port in passive mode. posted by Norm on Tue, 14 Oct 2003