![]() | 1 | initial version |
Yes, the ports are negotiated, or more accurately, announced. FTP can be Active Mode or Passive Mode. In the command channel, which is on port 21, look for PORT or PASV commands.
In an Active Mode connection, the client issues the PORT command and tells the server what IP address and port it will be listening on for the data connection. The server then connects to the client.
In a Passive Mode connection, the client issues the PASV command. The server then tells the client what IP address and port it will be listening on for the data connection, and the client connects to the server.