0 votes
by (120 points)
edited

I am having some difficulty with a specific type of connection that I've been working with for a couple days now. In particular its connecting to an FTP site on a local network using Rebex through android.

When it reaches connect it hangs them times out. The site is not blocked in any fashion because I can connect to it via a multitude of other apps or in browsers. For the "hostname" in connect() i have tried the local ip address (192.168.1.201), that computers hostname(EARTH) and the hostname of the site internally(ftp.photos.org). There's nothing fancy in code as its basically just the tutorial code. It works fine on any external dns type hostname.

Any ideas would be would be very helpful.

Code and exception as follows:

using (var client = new Ftp())
            {
                client.Connect( "EARTH", SslMode.None );
                client.Login( "login", "password" );

                client.PutFile( filePath, uploadName );

                client.Disconnect();
            }
08-05 16:13:46.266 I/mono-stdout( 4793): Rebex.Net.FtpException: An operation timed out. ---> Rebex.Net.ProxySocketException: An operation timed out.
08-05 16:13:46.276 I/mono-stdout( 4793):   at Rebex.Net.YU.EC (IAsyncResult A) [0x00000] in <filename unknown="">:0 
08-05 16:13:46.276 I/mono-stdout( 4793):   at Rebex.Net.EV.UC (IAsyncResult A, System.String B) [0x00000] in <filename unknown="">:0 
08-05 16:13:46.276 I/mono-stdout( 4793):   at Rebex.Net.EV.PB (IAsyncResult A) [0x00000] in <filename unknown="">:0 
08-05 16:13:46.276 I/mono-stdout( 4793):   at Rebex.Net.ProxySocket.Connect (System.String serverName, Int32 serverPort) [0x00000] in <filename unknown="">:0 
08-05 16:13:46.276 I/mono-stdout( 4793):   at Rebex.Net.OI..ctor (Rebex.Net.Ftp A, ISocketFactory B, System.String C, Int32 D) [0x00000] in <filename unknown="">:0 
08-05 16:13:46.276 I/mono-stdout( 4793):   at Rebex.Net.Ftp.QL (System.String A, Int32 B, Rebex.Net.TlsParameters C, FtpSecurity D) [0x00000] in <filename unknown="">:0 
08-05 16:13:46.276 I/mono-stdout( 4793):   --- End of inner exception stack trace ---
08-05 16:13:46.276 I/mono-stdout( 4793):   at Rebex.Net.Ftp.QL (System.String A, Int32 B, Rebex.Net.TlsParameters C, FtpSecurity D) [0x00000] in <filename unknown="">:0 
  at Rebex.Net.YU.EC (IAsyncResult A) [0x00000] in <filename unknown="">:0 
  at Rebex.Net.EV.UC (IAsyncResult A, System.String B) [0x00000] in <filename unknown="">:0 
  at Rebex.Net.EV.PB (IAsyncResult A) [0x00000] in <filename unknown="">:0 
  at Rebex.Net.ProxySocket.Connect (System.String serverName, Int32 serverPort) [0x00000] in <filename unknown="">:0 
  at Rebex.Net.OI..ctor (Rebex.Net.Ftp A, ISocketFactory B, System.String C, Int32 D) [0x00000] in <filename unknown="">:0 
  at Rebex.Net.Ftp.QL (System.String A, Int32 B, Rebex.Net.TlsParameters C, FtpSecurity D) [0x00000] in <filename unknown="">:0 
  --- End of inner exception stack trace ---

1 Answer

0 votes
by (58.9k points)
edited

We are internally using the .NET Socket class. We do not know whether the problem is occuring in Mono/Xamarin or Rebex component.

So would it be possible to test whether you are able to connect to your particular FTP server from your Android application without any Rebex code using only .NET Socket class like this?

        Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        sock.Connect(new IPEndPoint(IPAddress.Parse("ipAddress"), 21));
        sock.Close();

Please give it a try and let me know if the code above works for you or not.

...