Does anyone know how to use Pasv and Port with a Ftp server, how do i know witch port to use after I have used Pasv?
And is the default data port 20, i?m not really sure?

Thanks, Ante:confused:
Posted on 2002-01-31 13:17:52 by ante
I wouldn't know from the top of my head, but search for the FTP protocol in the RFC's:

Posted on 2002-01-31 13:23:21 by Thomas
i can tell you about pasv and a little about port.

to use pasv you must send to the server your connected to the PASV command but prior to that you need to make sure you are logged in properly. in response to a PASV command you will recieve something like this:

227 Entering Passive Mode (128,243,20,9,165,101).

whats happening now is that the server just gave you the information you need to connect to the data port.

128,243,20,9 ;<-- this is the same ip address you connected with on port 21
165,101 ;<-- these 2 numbers after some multipliction and addition will give you the data port you will need to connect to.

here is the formula you will need to use to get the port number:
1st number * 256 + 2nd number

so it will look like this:
165 * 256 + 101 = the data port

so the port you will need to connect to is port 42341

note: you will receive all the responses codes on port 21 such as when you send a LIST command. once you send the LIST command you will get a noticifaction on port 21 and will recieve directory on the data port you need to connect to prior to the LIST command.

as for the PORT command i havent used it yet but i believe instead of the server determining which port you will connect to, instead you will let the server know which port you would like to connect to to recieve data.
Posted on 2002-01-31 20:57:12 by smurf
thanks smurf
Posted on 2002-02-01 03:00:31 by ante