0

Running ftp in the active mode looks like described below (on this site):

In active mode FTP the client connects from a random unprivileged port (N > 1023) to the FTP server's command port, port 21. Then, the client starts listening to port N+1 and sends the FTP command PORT N+1 to the FTP server. The server will then connect back to the client's specified data port from its local data port, which is port 20

And here is my question. What happens when an extra client gets connected? Does the server opens an extra data port for that new connection? If so which port it selects for that?

3

A tcp session includes source port, source IP, destination port and destination IP.

These must be unique for each session.

So lets say client one opens a session, and gets a data connection back:

Control: source_ip:1024 -> server_ip:21
Data:    source_ip:1025 <- server_ip:20

Now the second session gets opened. Both 1024 and 1025 are already in use, so the next ones are:

Control: source_ip:1026 -> server_ip:21
Data:    source_ip:1027 <- server_ip:20

It won't necessarily increment in sequence like that, it depends what else is going on on the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.