This project is read-only.

ForwardedPortLocal and Connection error when re-conect secondtime to same forwardedport

Apr 10, 2013 at 4:58 PM
Edited Apr 10, 2013 at 5:06 PM

first thanks for your great work, with this SSH library.
I need help with ForwardedPortLocal.
I do a comunication with some remote hardware with Modbus protocol and trought SSH tunnel.
When i open the SSH and portforwading, the first time run correctly. But if i try to read a second time, the socket open ok, but is like the portforwading was disappear.

I explain with the steps i do:

1 - I open conection with SSH server (is a freeSHH)
dim SSHClient as SSHClient
SSHclient = New sshClient("", 555,"sshuser","sshpass")
2 - I do the 1st portforwading
 dim SSHport as ForwardedPortLocal
 SSHport = New ForwardedPortLocal("", 14011, "", 14011)
3 - Connect a socket on this port and read from the hardware over this location
NetTalk1.TcpIpConnect("", 14011, NetTalk.TcpIpProtocolType.Tcp, 2000,500)
NetTalk1.ReadAnalog("XMODBUSB", 16, 1, "4", 0, "", "", "", "", "", "", "", True) 
4 - create new ForwadedPortLocal
dim SSHport2 as ForwardedPortLocal
SSHport2 = New ForwardedPortLocal("", 14012, "", 14012)
5 - I Connect a socket on this port and read from the hardware over this location
NetTalk1.TcpIpConnect("", 14012, NetTalk.TcpIpProtocolType.Tcp, 2000,500)
NetTalk1.ReadAnalog("XMODBUSB", 16, 12, "4", 0, "", "", "", "", "", "", "", True) 
--> Up here, all well, socket established ok, and data from modbus is readed well and fast, .

BUT...Now, if i try to readt from 1st equipment on FordwardedPortLocal, socket established is ok, but any data is received. Also, i debug and when i try to do a
Really, the SSHclient.Forwadedports count is always = 2.
I try to do


and more, but without succes.

Could anyone help me about the correct way to do this ??

best regards.