0 votes
by (330 points)
edited

I used the sample code from the tutorial and I can't connect. This is the code I am using:

        Ftp ftp = new Ftp();
        ftp.CommandSent += new FtpCommandSentEventHandler(ftp_CommandSent);
        ftp.ResponseRead += new FtpResponseReadEventHandler(ftp_ResponseRead);

        try
        {
            TlsParameters par = new TlsParameters();
            par.CertificateVerifier = CertificateVerifier.AcceptAll;
            //ftp.Connect(hostname, 21, par, FtpSecurity.Explicit);
            ftp.Connect(hostname, 21, null, FtpSecurity.Explicit);
            ftp.Login(username, password);
            ftp.ChangeDirectory(dirChange);

            long bytes;
            if (method == "get")
            {
                bytes = ftp.GetFile(remoteFile, localFile);
            }
            else if (method == "put")
            {
                bytes = ftp.PutFile(localFile, remoteFile);
            }
            else
            {
                return;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            ftp.Disconnect();
            ftp.Dispose();
        }

The error I get is:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

I know this is a timeout error but I'm not sure what else to try.

When I change directories I see username.directory as the current directory. I assume that is correct. The last response I see is "Entering pasive mode".

Applies to: Rebex FTP/SSL
by (148k points)
edited

FTP uses a separate TCP connection for each data transfer. According to your description, it looks like it was not possible to establish it. Are you able to connect to the same server from the same client using any third-party FTP client (such as FileZilla) in "explicit TLS/SSL" mode?

by (330 points)
edited

Yes I can connect using another client on the same pc.

by (148k points)
edited

In that case, would it be possible to create two communication log - one from Rebex FTP/SSL, the other from another client, and mail them to support@rebex.net for analysis? By comparing the two logs, we should be able to tell what to change to make Rebex FTP/SSL work as well. (Use Ftp object's LogWriter property to create a log, as described at http://www.rebex.net/kb/logging.aspx)

by (148k points)
edited

Alternatively, try adding this line to your code (right below the Connect method): ftp.Options |= FtpOptions.ConnectPassiveLater; Does this have any effect?

by (330 points)
edited

When I make a reference to Rebex.Net i don't see any logging methods.

There is no ConnectPassiveLater value in the FtpOptions enum.

by (148k points)
edited

Which version of Rebex FTP/SSL do you use? It looks like it's more than 3 years old. Please try the latest version (3.0.4086.0), let us know whether there is any difference (both with and without the options) and use it to create the log.

by (330 points)
edited

Ok I get farther along now and get the error: username.directory.filename not found (550).

I know the file exists since I can see it using the other FTPS client.

Is that path above correct?

If I list the directory using the GetList() method I get the error that no datasets are found.

by (330 points)
edited

I sent a log. thanks

by (148k points)
edited

Thanks - I replied via e-mail. Looks like you are connecting to a mainframe server. These often have additional requirements, need special "SITE something" commands sent, etc. If you can connect with another client, the easiest solution would be to look into its log as well and compare it with Rebex FTP/SSL log to see what we do differently.

by (330 points)
edited

I was able to get this to work. The combination of the new bits and the fact that I was using a directory name without single quotes was the problem. The change directory command was taking me to username.dir instead the the correct directory which is why I was getting the filename not found 550 error.

I have a version question. The new bits I downloaded are breaking my SSH FTP now since it refers to a ProxySocket version problem. Should I start a new thread?

1 Answer

0 votes
by (330 points)
edited

I was able to get this to work. The combination of the new bits and the fact that I was using a directory name without single quotes was the problem. The change directory command was taking me to username.dir instead the the correct directory which is why I was getting the filename not found 550 error.

by (148k points)
edited

Thanks for letting us know about this, we might find it very useful if someone else runs into the same problem.

...