NetTools FTP Plugin & 500 Illegal Port

When you’re scripting a FileMaker Pro solution using the NetTools Plugin to connect to an FTP server, if you get an error "500 illegal port command", switching from Active Transfer Mode to Passive Transfer Mode will likely fix the error.

For example, if you had the NetTools function call:

SetField[
    External("JAVB-Command"; "NETT-FTPUseActiveTransferMode" )
]

Switch it to FTP Passive Mode with:

SetField[
   External("JAVB-Command"; "NETT-FTPUseActiveTransferMode" )
]

For a good background on Passive and Active mode transfers, see: slacksite.com/other/ftp.html. Here’s a couple excerpts from that page:

FTP Active Transfer Mode

In active mode FTP the client connects from a random unprivileged port (N > 1024) 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.

FTP Passive Transfer Mode

In order to resolve the issue of the server initiating the connection to the client a different method for FTP connections was developed. This was known as passive mode, or PASV, after the command used by the client to tell the server it is in passive mode.

In passive mode FTP the client initiates both connections to the server, solving the problem of firewalls filtering the incoming data port connection to the client from the server. When opening an FTP connection, the client opens two random unprivileged ports locally (N > 1024 and N+1). The first port contacts the server on port 21, but instead of then issuing a PORT command and allowing the server to connect back to its data port, the client will issue the PASV command. The result of this is that the server then opens a random unprivileged port (P > 1024) and sends the PORT P command back to the client. The client then initiates the connection from port N+1 to port P on the server to transfer data.

Leave a Reply

You must be logged in to post a comment.