Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Unassigned: The socket is not connected [2599]

$
0
0
Heya and thanks so much for this awesome library!
I'm actually using it in a Xamarin.iOS project (Shared Library) and evertyhing is working fine.
For testing purposes I'm forwarding my local port 8356 to 192.168.1.5's remote port 8080:
```
client.KeepAliveInterval = new TimeSpan(0, 0, 5);
client.Connect ();
port2 = new ForwardedPortLocal ("localhost", 8356, "192.168.1.5", 8080);
client.AddForwardedPort (port2);
port2.Exception += delegate(object sender, ExceptionEventArgs e)
{
Console.WriteLine(e.Exception.ToString());
};
port2.RequestReceived += delegate(object sender, PortForwardEventArgs e)
{
Console.WriteLine(e.OriginatorHost + ":" + e.OriginatorPort);
};
port2.Start ();
```

So I open localhost:8356 in my browser and the expected webpage appears. But approx. 5 secs after that, I get a SocketException: "The socket is not connected" in ForwardedPortLocal.NET.cs in
```
private static void CloseSocket(Socket socket)
```

at

```
socket.Shutdown(SocketShutdown.Both);
```

So just to make sure I modified it to:

```
if (socket.Connected)
{
socket.Shutdown(SocketShutdown.Both);
socket.Close();
}
```

strange enough, socket.Connected is true and exception is still thrown.

So as a rough fix I removed in FordwaredPortlocal.NET.cs in func private void AcceptCallback(IAsyncResult ar), line 102
```
channel.Close();
```
as well as CloseSocket(clientSocket); in the catch.

Anyone knows why this happens?
Comments: ** Comment from web user: Ravis **

Hi,
Thanks a lot for this wonderful library. Am successfully using this in my C# application.

Now the latest version am trying to use in my Xamarin.iOS project but Am getting the error MT2002: Failed to resolve "System.Diagnostics.TraceSource" reference from "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" while accessing the Renci.SshNet.SftpClient as part of my Xamarin project. How can I resolve this issue?

It seems there are some .net framework related namespaces which are not allowed like System.Diagnostics in mobile development. Can you please let me know which version support my Xamarin.iOS development?

Thanks,
Ravi Kumar


Viewing all articles
Browse latest Browse all 1026

Trending Articles