In my Xamarin.Forms Android App I get an Socket Exception when Rebex.Net.Sftp.ConnectAsync(...)
is called. The very first call to ConnectAsync()
always works, 2 or 3 call results in the exception.
Note, this only happens on Android 10 devices. On Android 8, 9, iOS, Windows 10 UWP it works without any problems.
This is the code I'm running :
private async void btnConnect_Clicked(object sender, EventArgs e)
{
try
{
using (var client = new Rebex.Net.Sftp())
{
client.LogWriter = new Rebex.TraceLogWriter();
await client.ConnectAsync("test.rebex.net");
client.Login("demo", "password");
}
}
catch(Exception ex)
{
Debug.WriteLine(ex.ToString());
}
}
The following Exception is thrown on
await client.ConnectAsync("test.rebex.net");
:
{Rebex.Net.SftpException: Socket error 10035 occured. ---> Rebex.Net.ProxySocketException: Socket error 10035 occured. ---> System.Net.Sockets.SocketException: Operation on non-blocking socket would block
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000b0] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/mcs/class/System/System.Net.Sockets/Socket.cs:892
at knhz.Connect (System.Net.EndPoint remoteEP) [0x00101] in <72a174b311e1464398a86f420b7afa81>:0
at knic.ccvf (System.Net.IPEndPoint qm) [0x0015c] in <72a174b311e1464398a86f420b7afa81>:0
at knie.xrcj (System.Net.EndPoint eza) [0x00045] in <72a174b311e1464398a86f420b7afa81>:0
at Rebex.Net.ProxySocket.Connect (System.Net.EndPoint remoteEP) [0x00132] in <72a174b311e1464398a86f420b7afa81>:0
--- End of inner exception stack trace ---
at Rebex.Net.ProxySocket.Connect (System.Net.EndPoint remoteEP) [0x00196] in <72a174b311e1464398a86f420b7afa81>:0
at Rebex.Net.ProxySocket.Connect (System.String serverName, System.Int32 serverPort) [0x0003d] in <72a174b311e1464398a86f420b7afa81>:0
at Rebex.Net.Sftp.dmah (System.String po, System.Int32 pp, Rebex.Net.SshParameters pq, qhhd pr) [0x001ac] in <95ea4ffd071e4c41be5d7d96f6b37bf1>:0
--- End of inner exception stack trace ---
at Rebex.Net.Sftp.dmah (System.String po, System.Int32 pp, Rebex.Net.SshParameters pq, qhhd pr) [0x0031f] in <95ea4ffd071e4c41be5d7d96f6b37bf1>:0
at Rebex.Net.Sftp.dmcn (System.Object ww, System.Enum wx, System.Object[] wy) [0x000a9] in <95ea4ffd071e4c41be5d7d96f6b37bf1>:0
at bmjn.rscp (System.Object iz) [0x00008] in <e621cf0ccc5b4395bd2422fc594466d0>:0
--- End of stack trace from previous location where exception was thrown ---
at SFTPTest.MainPage.btnConnect_Clicked (System.Object sender, System.EventArgs e) [0x00054] in C:\Repos\SFTPTest\SFTPTest\SFTPTest\MainPage.xaml.cs:46 }
Any ideas what the problem might be ?