sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
http://sshnet.github.io/SSH.NET/
MIT License
4.01k stars 932 forks source link

Feature request: Provide a way to bind the SSH clients to a local IP #42

Open psg666 opened 8 years ago

psg666 commented 8 years ago

Hi,

Would you consider adding LocalIP (and LocalPort defaulting to 0) property to the ConnectInfo? I have a multi-IP server and need to bind to a particular IP for the SFTP to go thru the firewall. I know that Socket.Bind is not supported by all target frameworks.

I ended up modifying the ConnectInfo with the two properties, the PasswordConnectionInfo to add the necessary constructors, the Session.SocketConnect to optionally construct an IPEndPoint and the SocketAbstraction.Connect to pass the local EndPoint and do a socket.Bind. I used FEATURE_SOCKET_SYNC to surround the socket.Bind to make the code compile. Of course this is a hack for my needs only.

DDinVA commented 8 years ago

@psg666 can you post what you did. I need it too!