EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Multi-Port Forwarding

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#23624
Posted: 02/21/2013 17:27:18
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

I am receiving the follow error from my application. I am call your library from my library

Exception:Thrown: "An invalid IP address was specified." (System.FormatException)
A System.FormatException was thrown: "An invalid IP address was specified."
#23625
Posted: 02/21/2013 17:31:58
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

" When exactly is the above code executed? Is it executed *before* you call TElSSHLocalPortForwarding.Open() or after that?

"""""""" ****Your Code***
int tunnelIdx = forwarding.AddTunnel();
forwarding.get_Tunnels(tunnelIdx).AutoOpen = true;
forwarding.get_Tunnels(tunnelIdx).DestHost = "10.20.10.204";
forwarding.get_Tunnels(tunnelIdx).DestPort = 7018;
forwarding.get_Tunnels(tunnelIdx).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx).ForwardedPort = 7018;
""""""""""

"""""""" The change I made
int tunnelIdx = forwarding.AddTunnel();
forwarding.get_Tunnels(tunnelIdx).DestHost = "10.20.10.204";
forwarding.get_Tunnels(tunnelIdx).DestPort = 7018;
forwarding.get_Tunnels(tunnelIdx).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx).ForwardedPort = 7018;
forwarding.get_Tunnels(tunnelIdx).Open();
""""""""

Your code did not produce an open port when I when to access it.

The change I made, I was able to access to port
#23626
Posted: 02/21/2013 17:41:01
by Ken Ivanov (EldoS Corp.)

Apparently, you are executing the above code *after* calling the main component's Open() method. This is not correct; relying on AutoOpen *after* the session has been initiated has no sense.

The rule is fairly simple. There are two general methods of establishing tunneling with simple forwarding components:

1. You configure all the tunnels beforehand (before calling TElSSHLocalPortForwarding.Open() method) and set the relevant AutoOpen properties to true. Then you call TElSSHLocalPortForwarding.Open(); all the tunnels with AutoOpen set to true will be set up automatically. Those with AutoOpen set to false will not.

2. You configure the tunnels after calling the TElSSHLocalPortForwarding.Open() method. AutoOpen property has no effect in this case; you MUST call each tunnel's Open() method explicitly to set it up.

Now, if the below code of yours

Code
int tunnelIdx = forwarding.AddTunnel();
forwarding.get_Tunnels(tunnelIdx).AutoOpen = true;
forwarding.get_Tunnels(tunnelIdx).DestHost = "10.20.10.204";
forwarding.get_Tunnels(tunnelIdx).DestPort = 7018;
forwarding.get_Tunnels(tunnelIdx).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx).ForwardedPort = 7018;


is executed *after* TElSSHLocalPortForwarding.Open() was called, nothing will happen. AutoOpen has no sense when the session is active, so you must call forwarding.get_Tunnels(tunnelIdx).Open() to activate the tunnel.
#23627
Posted: 02/21/2013 17:47:19
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

Quote

Apparently, you are executing the above code *after* calling the main component's Open() method. This is not correct; relying on AutoOpen *after* the session has been initiated has no sense.

The rule is fairly simple. There are two general methods of establishing tunneling with simple forwarding components:

1. You configure all the tunnels beforehand (before calling TElSSHLocalPortForwarding.Open() method) and set the relevant AutoOpen properties to true. Then you call TElSSHLocalPortForwarding.Open(); all the tunnels with AutoOpen set to true will be set up automatically. Those with AutoOpen set to false will not.

2. You configure the tunnels after calling the TElSSHLocalPortForwarding.Open() method. AutoOpen property has no effect in this case; you MUST call each tunnel's Open() method explicitly to set it up.

Now, if the below code of yours

Code
int tunnelIdx = forwarding.AddTunnel();
forwarding.get_Tunnels(tunnelIdx).AutoOpen = true;
forwarding.get_Tunnels(tunnelIdx).DestHost = "10.20.10.204";
forwarding.get_Tunnels(tunnelIdx).DestPort = 7018;
forwarding.get_Tunnels(tunnelIdx).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx).ForwardedPort = 7018;


is executed *after* TElSSHLocalPortForwarding.Open() was called, nothing will happen. AutoOpen has no sense when the session is active, so you must call forwarding.get_Tunnels(tunnelIdx).Open() to activate the tunnel.



The way you have it stated. I try it that way in your Simple Forwarding Demo
I could not connect to the port.
#23628
Posted: 02/21/2013 17:51:34
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

I received the following exception.

Exception:Thrown: "An invalid IP address was specified." (System.FormatException)
A System.FormatException was thrown: "An invalid IP address was specified."


How can I fine which of your routines the error is be produced.
#23629
Posted: 02/21/2013 17:56:02
by Ken Ivanov (EldoS Corp.)

Could you please show us the whole body(-ies) of the method(s) of the simple forwarding sample you've altered?

Please use the QUOTE and CODE buttons/tags to separate logical pieces in your posts to improve readability. I'll correct your message above now.
#23630
Posted: 02/21/2013 17:59:06
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

""
private void button1_Click(object sender, EventArgs e)
{
int tunnelIdx = forwarding.AddTunnel();
//forwarding.get_Tunnels(tunnelIdx).AutoOpen = true;
forwarding.get_Tunnels(tunnelIdx).DestHost = "10.20.10.204";
forwarding.get_Tunnels(tunnelIdx).DestPort = 7018;
forwarding.get_Tunnels(tunnelIdx).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx).ForwardedPort = 7018;
forwarding.get_Tunnels(tunnelIdx).Open();

int tunnelIdx2 = forwarding.AddTunnel();
// forwarding.get_Tunnels(tunnelIdx2).AutoOpen = true;
forwarding.get_Tunnels(tunnelIdx2).DestHost = "10.20.10.204";
forwarding.get_Tunnels(tunnelIdx2).DestPort = 7040;
forwarding.get_Tunnels(tunnelIdx2).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx2).ForwardedPort = 7040;
forwarding.get_Tunnels(tunnelIdx2).Open();

int tunnelIdx3 = forwarding.AddTunnel();
// forwarding.get_Tunnels(tunnelIdx3).AutoOpen = true;
forwarding.get_Tunnels(tunnelIdx3).DestHost = "10.20.10.204";
forwarding.get_Tunnels(tunnelIdx3).DestPort = 7008;
forwarding.get_Tunnels(tunnelIdx3).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx3).ForwardedPort = 7008;
forwarding.get_Tunnels(tunnelIdx3).Open();
}

""
#23631
Posted: 02/22/2013 02:12:29
by Ken Ivanov (EldoS Corp.)

Thank you, that's exactly what I supposed. This code won't work without the Open() lines if you click the 'Button 1' button after clicking the 'Start' button.
#23640
Posted: 02/22/2013 10:48:28
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

In your demo:
I try it last again after click start. I add a second button.
to run the additional tunnels

I have set them to AutoOpen and it did not work.


I created a tested application with a window form and a library.
the out of 4 autoopens 3 worked
#23641
Posted: 02/22/2013 10:50:16
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

do I need to remove a tunnel if I want to change to parameters of the tunnel

like the forwarded port, dest Host & port.
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.

Reply

Statistics

Topic viewed 13847 times

Number of guests: 3, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!