In FTP active and passive modes changing ports

I am new to FTP protocol, here i have read about active and passive modes in ftp.

Active mode: means client will send port number to server for Data communication. Passive mode:means server will send port number to client for Data communication.

Here these and all okay

my doubt is in passive mode For initial control connection both will communicate on some port no example 5000 .After server receive "PASV" command server will send port number example 5010.

  1. After server sends port number to client, whether server should close port no 5000,and start listing on 5010 port? or both ports should be active?

  2. for Commands i need to use older port(5000) and for data communication i need to use new port(5010), or how it is?

Can anyone help me this

3

1 Answer

FTP protocol differs from simpler protocols like ssh or HTTP in that it uses two ports (and two connections) simultaneously.

The port you initially connect to is the command port. The connection to this port is active until the session is terminated and all commands are sent to this port.

When you issue commands that start data transfer - like get or put - another connection (called data connection) is established on another port (data port). This connection is from server to client in active mode and from client to server in passive mode. This connection lasts only for the duration of the data transfer and it is closed after the transfer is finished.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like