Search code examples
ftpprotocolsftp-clientftps

Can both sides send data on an FTP bi-directional data connection


I always thought that when FTP data connection opens, it transfers data only in one way.

Now I found out that both sides can transfer data on the opened data connection.

My questions:

  1. What is it used for? I read that it can be used to transfer files over SSL, so the bi-directional is used for negotiation, but then why not using ftps?
  2. Data connection opens for transfer of files and listing (anything else?). So what should the sending side do when it receives data from the other side? how would it process it?
  3. Are there clients supporting this behavior?
  4. Is it common?

Solution

  • You are correct that FTP RFC really mentions possibility that data connection is used bi-directionally:

    It ought to also be noted that the data connection may be used for simultaneous sending and receiving

    But it's likely that the RFC authors just wanted to make sure such option is available for future features of the protocol.

    But as far as I know, there's actually no such feature that make use of bi-directional data connection.

    The FTP protocol does not allow simultaneous transfers at all, neither in the same nor opposite direction.

    Currently the data connection is used:

    • For downloads, where only the server sends data.
    • For uploads, where only the client sends data.
    • For directory listings, where only the server sends data.

    Regarding FTPS: Indeed if the data connection is encrypted using TLS/SSL, the connection is used bi-directionally on TCP-level, when the client and the server negotiate the encryption. But I do not think this is what the RFC refers too, as SSL/TLS did not exist at the time and the negotiation is out of scope of FTP protocol anyway.