FTP.Connect works fine
FTP.ChangeDir() works fine
FTP.Put(LocalFileName,RemoteFileName) give me an exception "Invalid PORT
Command"
on tracing the code it seems the port command is a local port being
assigned, not the remote port.
Any ideas? I have to get this project out ASAP and this is the only problem
I am having (so far). I have disabled my software firewall for testing and
my WS_FTP program has no problem connecting to the same site and uploading.
Also, can a remote port number be specified as par tof the .host property
using server:port or do I need to use FTP.Port := to specify an alternate
remote port?
Thanks for any help and happy new year to all!
-Johnnie
Without seeing a packet trace of the actual PORT command, it is hard to say
for sure, but the server probably does not support Active transfers. Try
setting the Passive property to true and try again.
> on tracing the code it seems the port command is a local port
> being assigned, not the remote port.
That is what it is supposed to be doing.
The FTP protocol uses separate socket connections for data transfers. For
"Active" transfers, the FTP client (TIdFTP in this case) opens a listening
socket that the FTP server has to actively connect to. The PORT command
tells the FTP server which port number the client is listening on.
For "Passive" transfers, on the other hand, the FTP server opens a listening
socket that the FTP client has to connect to. The reply to the PASV command
specifies the port number that the FTP server is listening on.
> I have disabled my software firewall for testing and my WS_FTP
> program has no problem connecting to the same site and uploading.
Chances are, WS_FTP is using Passive mode transfers. You should do that in
your own code anyway because Passive mode transfers are more
firewall-friendly than Active mode transfers.
> Also, can a remote port number be specified as par tof the .host property
No.
> do I need to use FTP.Port := to specify an alternate remote port?
Yes.
Gambit
Changing to passive mode fixed the problem.
-Johnnie