Hello.

I am trying to establish why I cannot open a data connection when a
embedded FTP client is trying to establish a data connection to my FTP
server.

The embedded client is Apache Commons.NET FTPSClient running on a Unix
environment. The FTP server is running on a windows machine.

When the FTP client requests a file, it goes into my onDownloadStart()
method on my FTPLet, and I perform the following:


        DefaultFtpSession ioSession = (DefaultFtpSession) session;
        String fileName = request.getArgument();

        DataConnectionFactory dfc = ioSession.getDataConnection();

        ioSession.write(new
DefaultFtpReply(DefaultFtpReply.REPLY_150_FILE_STATUS_OKAY,
        "About to open data connection"));

        try
        {

            DataConnection out = dfc.openConnection();
            if (out == null)
            {
                ioSession.write(new
DefaultFtpReply(DefaultFtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION,
                    "Cannot open data connection"));

                VACSReport.getInstance().insertExceptionLogEntry(
                    0,"Cannot open data connection");

                return FtpletResult.SKIP;
            }
            else
            {

The problem is that that out is null so I cannot open the data connection.

My understanding of passive FTP is that the serer states a port for
the client to connect on (in this case 249), so why does the server
have to open the DataConnection to the server. In this case, it cannot
because port 249 is not open on my Unix firewall.

Some output from my server console is:

20:26:24,610 INFO  [FtpLoggingFilter] RECEIVED: PASV
20:26:24,610 INFO  [FtpLoggingFilter] SENT: 227 Entering Passive Mode
(172,16,100,204,15,249)


I hope this is understandable, if not, please ask.

Kind regards

Aidan Diffey

Reply via email to