login about faq

I am attempting to connect to RaspberryPi 3 Windows 10 IoT which is running ftpd. I can connect to it using Filezilla without any issues. I installed the latest from NuGet in Visual Studio 2017 Enterprise.

Below is the sample code I am using to attempt to connect. It fails at ftp.ConnectAsync() with:

ChilkatLog: Connect_Ftp2: DllDate: May 29 2017 ChilkatVersion: 9.5.0.68 UnlockPrefix: Anything for 30-day trial Architecture: Little Endian; 32-bit VerboseLogging: 0 ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring ImplicitSsl: 0 AuthTls: 0 AuthSsl: 0 ftpConnect: Hostname: 10.200.10.207 Port: 21 IdleTimeoutMs: 60000 readCommandResponse: Failed to receive more bytes. Failed to read FTP control channel reply. --readCommandResponse initialStatus: 0 initialResponse: --ftpConnect Failed to connect to FTP server. Failed. --Connect_Ftp2 --ChilkatLog


           Chilkat.Ftp2 ftp = new Chilkat.Ftp2();

            bool success;

            //  Any string unlocks the component for the 1st 30-days.
            success = ftp.UnlockComponent("Anything for 30-day trial");
            if (success != true)
            {
                Debug.WriteLine(ftp.LastErrorText);
                return;
            }

            ftp.Hostname = "10.200.10.207";
            ftp.Username = "User";
            ftp.Password = "Password";
            ftp.Port = 21;

            //  Connect and login to the FTP server.
            success = await ftp.ConnectAsync();
            if (success != true)
            {
                Debug.WriteLine(ftp.LastErrorText);
                return;
            }

            //  Set the transfer mode to ASCII
            success = await ftp.SetTypeAsciiAsync();
            if (success != true)
            {
                Debug.WriteLine(ftp.LastErrorText);
                return;
            }

            //  Change to the remote directory where the file will be uploaded.
            success = await ftp.ChangeRemoteDirAsync("junk");
            if (success != true)
            {
                Debug.WriteLine(ftp.LastErrorText);
                return;
            }

            //  Upload a file.
            string localFilename = "hamlet.xml";
            string remoteFilename = "hamlet.xml";

            //  Turn on session logging for the upload:
            ftp.KeepSessionLog = true;

            success = await ftp.PutFileAsync(localFilename, remoteFilename);
            if (success != true)
            {
                Debug.WriteLine(ftp.LastErrorText);
                return;
            }

            //  View the session log.  You can verify visually that
            //  the transfer was in ascii mode.
            Debug.WriteLine(ftp.SessionLog);

            success = await ftp.DisconnectAsync();

            Debug.WriteLine("File Uploaded!");

asked Jul 25 at 12:05

damonkh's gravatar image

damonkh
1


Just an update. I added:| int failReason = ftp.ConnectFailReason;

Debug.WriteLine("connect fail reason = " + Convert.ToString(failReason));

Which returns: connect fail reason = 200

I cannot find this reason documented.

Thanks

link

answered Jul 25 at 12:43

damonkh's gravatar image

damonkh
1

200 = Connected, but failed to receive greeting from FTP server.

Source

link

answered Jul 26 at 05:00

Dempsey's gravatar image

Dempsey
6116

Thanks. I added an ftp.IdleTimeoutMs = 120000; per another thread on this issue, but no joy. I am extremely flummoxed. Using Filezilla quick connect with port 21 explicit works just fine, so I don't understand why a simple connection on port 21 using FTP2 is failing.

Bear with me as I am a relative noob to all this.

(Jul 26 at 10:31) damonkh

Windows Firewall blocks the port. You can make exceptions for particular applications in Windows Firewall (i.e. .exe files). When FileZilla installs, it adds a rule to Windows Firewall to make an exception for it. You need to make an exception for your application's .exe, or just add a rule to Windows Firewall to allow outbound port 21.

It's really important that people understand how their firewalls work - whether it be software or hardware. Take some time to learn about it. Without understanding, 2 things happen:

1) Your system could be insecure without you having a clue.
2) You end up being flummoxed and wasting a good portion of your life wondering why things don't work.

link

answered Jul 26 at 10:36

chilkat's gravatar image

chilkat ♦♦
12.8k317367485

Yup that was one of the first things I checked. I made a specific rule on both in/out for port 21 to allow my program through. NoJoy. I then turned off the firewall just to double check. Still NoJoy. Murphy seems to be sitting on my shoulder this week. All sorts of things just not working. LOL.

(Jul 26 at 11:45) damonkh

So, I double checked the firewall yesterday. My project app is set to be allowed through the firewall. Again, I even turned off the firewall. I don't run any 3rd party anti-virus. Just windows Defender. I even turned that off for a test.

I am running Windows 10 Pro. Visual Studios 2017 Enterprise. A Raspberry Pi 3 with Windows IoT installed and running their ftpd daemon.

I will continue working on this issue. I am evaluating this for the company. We are excited to use this if we can.

I am going to work with another person locally to see if we can get this resolved.

link

answered Jul 27 at 11:32

damonkh's gravatar image

damonkh
1

On re-reading the error message, it looks as though the TCP connection was established, but the initial greeting from the FTP server was not received.

link

answered Jul 27 at 11:42

chilkat's gravatar image

chilkat ♦♦
12.8k317367485

Just a note. I also have a dreamhost account and attempted to ftp to that and received the same error. Filezilla works under both scenarios. Should I try a simple C# app, not a UWP app?

(Jul 27 at 12:10) damonkh

Thanks! Yes, try a simple C# app.

I'm not a big fan of UWP and would never recommend it to anyone..

(Jul 27 at 12:13) chilkat ♦♦

Unfortunately, UWP is what we are developing in. :/

(Jul 27 at 13:10) damonkh

OK. So switching to a c# .net test it works. Connected, uploaded file and disconnected.

Sadly, this is not an option :/ Ultimately, I will need to perform this using IoT, Android, and iOS. For now, we are focusing in on IoT.

(Jul 27 at 13:28) damonkh

This problem should be fixed here: https://www.nuget.org/packages/Chilkat.uwp/9.5.0.69-pre

link

answered Aug 09 at 11:35

chilkat's gravatar image

chilkat ♦♦
12.8k317367485

Sorry I've been so busy, but am going to be trying this out today and I will get back to you on how it works. Thank you.

(Aug 17 at 12:56) damonkh
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×144

Asked: Jul 25 at 12:05

Seen: 399 times

Last updated: Aug 17 at 12:56

powered by OSQA