Skip to content

Instantly share code, notes, and snippets.

@darinkes
Created March 31, 2014 10:13
Show Gist options
  • Save darinkes/9889276 to your computer and use it in GitHub Desktop.
Save darinkes/9889276 to your computer and use it in GitHub Desktop.
make portforwarding more stable Found while testing portforwarding with http and some real quick reloads. Port-Forwardings crashes when unable to ship data. https://sshnet.codeplex.com/discussions/446914
diff --git a/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs b/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs
index c0518ce..dccca76 100644
--- a/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs
+++ b/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs
@@ -21,7 +21,14 @@ namespace Renci.SshNet.Channels
partial void InternalSocketSend(byte[] data)
{
- this._socket.Send(data, 0, data.Length, SocketFlags.None);
+ try
+ {
+ this._socket.Send(data, 0, data.Length, SocketFlags.None);
+ }
+ catch (Exception exp)
+ {
+ // XXX: ignore/log?
+ }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment