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

Created 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?

Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>