Hi,
I detected a problem when using PortForwading.
The first time, the tunneling is working properly, but after closing, the forwading rule is still working,
_port = New ForwardedPortLocal("127.0.0.1", 14444, _SSHForwardIP, 1433)
and _port.IsStarted is True
After close connection and open to another SSH server, the first portforwading rule is still running, and the next rule doesn't works.
This is the state for second time with connecting to a new ssh server ip, connected state is true.
![Image]()
Any idea how to repair??
I detected a problem when using PortForwading.
The first time, the tunneling is working properly, but after closing, the forwading rule is still working,
' RENCI
Dim client As SshClient
Dim port As ForwardedPortLocal
Public Sub SSHDisconnect(ByRef _client As SshClient, ByRef _port As ForwardedPortLocal)
_port.Stop()
_client.Disconnect()
_client.RemoveForwardedPort(_port)
End Sub
I use this sequence for open: Public Function SSHConect(ByRef _client As SshClient, ByRef _port As ForwardedPortLocal, _SSHIPserver As String, _SSHPortServer As Integer, _SSHForwardIP As String, _SSHForwardPort As Integer) As Boolean
If (Not IsNothing(_client)) Then
If (_client.IsConnected) Then
'_port.Stop()
'_client.RemoveForwardedPort(_port)
_client.Disconnect()
End If
End If
SSHConect = False
_client = New SshClient(_SSHIPserver, _SSHPortServer, "userssh", "1111aA")
_client.KeepAliveInterval = New TimeSpan(0, 0, 30)
_client.Connect()
_client.SendKeepAlive()
If _client.IsConnected Then
Try
_port = New ForwardedPortLocal("127.0.0.1", _SSHForwardPort, _SSHForwardIP, _SSHForwardPort)
_client.AddForwardedPort(_port)
_port.Start()
If (_port.IsStarted) Then
SSHConect = True
Else
SSHConect = False
End If
Catch ex As Exception
MessageBox.Show(ex.ToString())
SSHConect = False
End Try
End If
End Function
When connection is established first time is possible to SELECT from SQLServer database without problems. _port = New ForwardedPortLocal("127.0.0.1", 14444, _SSHForwardIP, 1433)
and _port.IsStarted is True
After close connection and open to another SSH server, the first portforwading rule is still running, and the next rule doesn't works.
This is the state for second time with connecting to a new ssh server ip, connected state is true.

Any idea how to repair??