I can connect to an FTP site but I can't list or transfer files.

原文

FTP sessions use two network connections:

  1. The control channel is for user authentication and sending commands and ...

  2. The data channel is for transferring files and directory listings.

If you can connect to an FTP server but not transfer files or directory listings, the most likely cause is a blocked data channel.

More About FTP Control Channels

FTP sessions are established on the FTP control channel. If you are able to connect and authenticate then your control channel is probably fine. The default port is 21 for most control channels except for FTPS Implicit connections for which 990 is the default. Use the /port=x option of the FTPLOGON command to make Robo-FTP attempt a control channel connection on a specific port.

More About FTP Data Channels

FTP data channels are opened and closed as needed during an FTP session. There are two methods or opening a data channel:

  1. Passive Mode is the preferred data channel method for modern FTP clients because, in this mode, the client opens an outbound connection to a port specified by the server. A client sends the PASV command to request that a server allow an inbound data channel connection. The server responds with an IP address and port number on which it will be waiting for the client to open a connection.

  2. Active Mode is falling out of favor because it requires that the server make an inbound connection to the client computer. When a client requests an active mode connection, it sends the PORT command along with its IP address and the port where it will be waiting for the server to open a connection.

Beginning with version 3.7 Robo-FTP defaults to passive mode because, in our experience, the chances of making a successful outbound connection are higher than those of accepting a successful inbound connection.

Troubleshooting

When you can connect but not list or transfer files, the first troubleshooting step should be to try the opposite data channel mode. In Robo-FTP, add the /pasv=false option to the FTPLOGON command line to use active mode or remove it to revert to the default passive mode.

If you are using passive mode data connections:

  1. Contact the owner of the FTP server and ask "What is your passive port range?" then ask your network administrator to allow outboundconnections to the FTP server on that port range.

  2. Decode the port number from the server's PASV response (see below) and then use the Classic TCP-only Javascript Client onwww.firebind.com to test outbound connectivity on that port.

If you are using active mode data connections:

  1. Ask your network administrator to allow inbound connections to your computer and then use the /minport/maxport and /myipaddroptions of the FTPLOGON command to force Robo-FTP to send a public IP address in an allowed port range.

Decoding port numbers

Examine the Trace Log and find the PORT or PASV command. There should be six digits separated by commas. To decode the port number, take the 5th number and multiple by 256 then add the 6th number. For example, if your Trace Log contains this:

->- PASV
-<- 227 Entering Passive Mode (209,198,133,148,170,225)

This means that the server is waiting for an incoming passive mode data channel connection on port 43745

43745 = (170 * 256) + 225
原文地址:https://www.cnblogs.com/philzhou/p/3319833.html