The question is in the title. The reason I wonder this is because I'm coding an tcp service and would like to explore some of the reasons as they may shed some light on my work.
|
feedback
|
|
I expect that the use of a different port simplifies the handling of the separate expected data connection, which will be in a format different from the control connection. I believe this would allow the receiver to simply start processing the data without having to check if it was a connection initiation as would need to be done if it used port 21. This would allow the last bullet's example of a linefeed printer start receiving text to print. However, I'm not sure how this was actually used back then (a program on the terminal would forward port 20 to their linefeed printer because there might be a FTP daemon already listening on 21?) As for the why another connection, there's three primary reasons:
| |||||||
feedback
|
|
Over-engineering might be the main reason. One (not often used) advantage of the split control/data connections is that it is possible for the client to start a transfer between two servers without the data needing to pass through the client. | |||||||||||||
feedback
|
|
FTP uses one port for data transmission (20) and other to send the commands (21), GET, DIR, PUT, etc... A more thorough explanation can be found here: http://slacksite.com/other/ftp.html HTH! | |||
|
feedback
|
|
Over-engineering is not the case. It was designed this way, so that different modes of operation are allowed. Active FTP is nowadays rarely used, because in this mode the server connects back to the client. But back then - in the 80s - it was working quite well. Passive FTP is very useful behind firewalls nowadays, in this mode the client connects to ports opened by the Server; the clients are usually not reachable directly anymore because they have a firewall/NAT/appliance in front of them. So this mode also makes sense. The wikipedia article has nice, detailed info: http://en.wikipedia.org/wiki/FTP | |||
|
feedback
|
|
FTP evolved from telnet, which only uses a command port. | |||
|
feedback
|