EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Multi-Port Forwarding

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
Posted: 03/04/2013 04:58:01
by Ken Ivanov (Team)

Unfortunately, it is hard to guess what the problem is (and whether there is a problem at all) only having the connection state trace and without knowing the specifics of the applications and the behaviour exposed by them. Depending on the protocol used by the forwarded connection, one will get different state traces. For example, the first two logs may be produced by a HTTP connection with keep-alives on, while the latest log looks fairly legal for a non-keep-alive HTTP connection.
Posted: 03/04/2013 12:48:54
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

These are the setting
            // forwarding
            this.forwarding.Address = null;
            this.forwarding.AuthAttempts = 1;
            this.forwarding.AuthenticationTypes = 4;
            this.forwarding.AutoAdjustCiphers = false;
            this.forwarding.AutoAdjustPriority = true;
            this.forwarding.CertAuthMode = SBSSHClient.TSBSSHCertAuthMode.camAuto;
            this.forwarding.ClientHostname = null;
            this.forwarding.ClientUsername = null;
            this.forwarding.CloseIfNoActiveTunnels = true;
            this.forwarding.CompressionLevel = 0;
            this.forwarding.CryptoProviderManager = null;
            this.forwarding.DefaultWindowSize = 2048000;
            this.forwarding.DestHost = null;
            this.forwarding.DestPort = 0;
            tElDNSSettings1.AllowStatuses = ((byte)(11));
            tElDNSSettings1.Port = ((ushort)(53));
            tElDNSSettings1.QueryTimeout = ((ushort)(3000));
            tElDNSSettings1.TotalTimeout = ((ushort)(15000));
            this.forwarding.DNS = tElDNSSettings1;
            this.forwarding.FlushCachedDataOnClose = true;
            this.forwarding.ForceCompression = false;
            this.forwarding.ForwardedHost = "";
            this.forwarding.ForwardedPort = 0;
            this.forwarding.ForwardedUseIPv6 = false;
            this.forwarding.ForwardedUsingIPv6 = false;
            this.forwarding.GlobalKeepAlivePeriod = 0;
            this.forwarding.GSSDelegateCredentials = false;
            this.forwarding.GSSHostName = "";
            this.forwarding.GSSMechanism = null;
            this.forwarding.IncomingSpeedLimit = 0;
            this.forwarding.Intercept = null;
            this.forwarding.KeepAlivePeriod = 0;
            this.forwarding.KeyStorage = null;
            this.forwarding.MaxSSHPacketSize = 262144;
            this.forwarding.MinWindowSize = 2048;
            this.forwarding.OutgoingSpeedLimit = 0;
            this.forwarding.Password = null;
            this.forwarding.Port = 0;
            this.forwarding.Priority = SBSSHForwarding.TSBSSHForwardingPriority.sfpNormal;
            this.forwarding.ReportRealClientLocationToServer = false;
            this.forwarding.RequestPasswordChange = false;
            this.forwarding.ResolveDynamicForwardingAddresses = false;
            this.forwarding.SessionTimeout = 0;
            this.forwarding.SocketTimeout = 0;
            this.forwarding.SocksAuthentication = 0;
            this.forwarding.SocksPassword = null;
            this.forwarding.SocksPort = 0;
            this.forwarding.SocksResolveAddress = false;
            this.forwarding.SocksServer = null;
            this.forwarding.SocksUseIPv6 = false;
            this.forwarding.SocksUserCode = null;
            this.forwarding.SocksVersion = 0;
            this.forwarding.SoftwareName = "SSHBlackbox.8";
            this.forwarding.SSHAuthOrder = SBSSHCommon.TSBSSHAuthOrder.aoDefault;
            this.forwarding.SynchronizeGUI = true;
            this.forwarding.Tag = null;
            this.forwarding.TrustedKeys = null;
            this.forwarding.UseDynamicForwarding = false;
            this.forwarding.UseIPv6 = false;
            this.forwarding.Username = null;
            this.forwarding.UseSocks = false;
            this.forwarding.UseUTF8 = false;
            this.forwarding.UseWebTunneling = false;
            this.forwarding.Versions = ((short)(2));
            this.forwarding.WebTunnelAddress = null;
            this.forwarding.WebTunnelAuthentication = 0;
            this.forwarding.WebTunnelPassword = null;
            this.forwarding.WebTunnelPort = 0;
            this.forwarding.WebTunnelUserId = null;
            this.forwarding.OnAuthenticationFailed += new SBSSHCommon.TSSHAuthenticationFailedEvent(this.forwarding_OnAuthenticationFailed);
            this.forwarding.OnAuthenticationSuccess += new SBUtils.TNotifyEvent(this.forwarding_OnAuthenticationSuccess);
            this.forwarding.OnError += new SBSSHCommon.TSSHErrorEvent(this.forwarding_OnError);
            this.forwarding.OnKeyValidate += new SBSSHCommon.TSSHKeyValidateEvent(this.forwarding_OnKeyValidate);
            this.forwarding.OnOpen += new SBUtils.TNotifyEvent(this.forwarding_OnOpen);
            this.forwarding.OnClose += new SBUtils.TNotifyEvent(this.forwarding_OnClose);
            this.forwarding.OnConnectionOpen += new SBSSHForwarding.TSBSSHConnectionEvent(this.forwarding_OnConnectionOpen);
            this.forwarding.OnConnectionClose += new SBSSHForwarding.TSBSSHConnectionEvent(this.forwarding_OnConnectionClose);
            this.forwarding.OnConnectionChange += new SBSSHForwarding.TSBSSHConnectionEvent(this.forwarding_OnConnectionChange);
            this.forwarding.OnConnectionError += new SBSSHForwarding.TSBSSHConnectionErrorEvent(this.forwarding_OnConnectionError);
Posted: 03/04/2013 12:53:02
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

I used your application demo an added to following code

private void AdditionalPorts()

Log("Additional Port Run", false);
int tunnelIdx = forwarding.AddTunnel();

forwarding.get_Tunnels(tunnelIdx).DestHost = "";
forwarding.get_Tunnels(tunnelIdx).DestPort = 7014;
forwarding.get_Tunnels(tunnelIdx).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx).ForwardedPort = 7014;
//forwarding.get_Tunnels(tunnelIdx).AutoOpen = true;

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

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

int tunnelIdx4 = forwarding.AddTunnel();
// forwarding.get_Tunnels(tunnelIdx4).AutoOpen = true;
forwarding.get_Tunnels(tunnelIdx4).DestHost = "";
forwarding.get_Tunnels(tunnelIdx4).DestPort = 7010;
forwarding.get_Tunnels(tunnelIdx4).ForwardedHost = "";
forwarding.get_Tunnels(tunnelIdx4).ForwardedPort = 7010;

Log("Additional Port opened", false);


As you can see a added the additionalport function the the btnStart_Click

private void btnStart_Click(object sender, System.EventArgs e)
if (!forwarding.Active)
forwarding.Address = tbHost.Text;
forwarding.Port = Convert.ToInt32(tbPort.Text, 10);
forwarding.ForwardedHost = "";
forwarding.ForwardedPort = Convert.ToInt32(tbForwardedPort.Text, 10);
forwarding.DestHost = tbDestHost.Text;
forwarding.DestPort = Convert.ToInt32(tbDestPort.Text, 10);
forwarding.Username = tbUsername.Text;
forwarding.Password = tbPassword.Text;

After I run your demo and click on start and authentication and connection is successful and I open up winamp or windows Media player or both
Posted: 03/04/2013 12:59:16
by Eugene Mayevski (Team)

Please remember to use code tag or CODE button to mark your code blocks for better readability.

Sincerely yours
Eugene Mayevski
Posted: 03/04/2013 13:51:38
by Ken Ivanov (Team)

Your code is not correct enough. You should not attempt to open additional ports until the connection is fully established and the OnOpen event fired. The TElSSHLocalPortForwarding.Open() method runs asynchronously and returns before the connection is actually opened.

In general, may I kindly ask you to be more descriptive when seeking assistance from our technical support people. When reporting a problem or asking a question please tell us in detail

- what your goal is,
- what did you do to achieve it,
- what you expected to happen,
- what actually happens.

This will help us understand your circumstances more clearly and provide you with a better and faster support, as we wouldn't need to make any (possibly, wrong) assumptions about the matter.
Posted: 03/04/2013 14:28:27
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

This is what I need I need to be able to on up a secure shell connection create two peramenant port and rotate between three additional ports.

Example connect SSh
Create Database port
Crate LDAP port

on the fly create audio 1 port
When I create audio 2 port
remove audio one port
When I create audio 3 port
Remove Audio 2 port

when i create audio one for the second time
remove audio 3 port.

Please your library is now becoming part of my audio library.

This is a multi trhead application.

What I am looking to do does work under Dart Communications Power TCP library.

However it is only dor dot net. I need Dot Net and C++. That why I asked before do you have a C# wrapper for you C++ library.

Let me know what we can do.
Posted: 03/04/2013 15:21:57
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

The forward on open does not fit into the way the program work
Posted: 03/04/2013 16:57:27
by Ken Ivanov (Team)

Thank you for the clarification, now your goal seems to be more or less clear to us.

However it is only dor dot net. I need Dot Net and C++. That why I asked before do you have a C# wrapper for you C++ library.

SecureBlackbox is shipped in several editions, which can be used on different platforms. In particular, there are a .NET one (can be used from C# and managed C++), Library (can be used from VC++, C++ builder, GCC, minGW and XCode) and VCL (for Delphi and C++ builder) editions.

The forward on open does not fit into the way the program work

Well, you can use some synchronization primitive (say, manual reset event) to perform the component calls synchronously. At the very start you would reset the event, call Open() and then wait for the event to signal. In the OnOpen handler you would move the event to the signaled state. After the wait succeeded, you would go on with opening the tunnels.
Posted: 03/05/2013 08:32:29
by Carlton  (Basic support level)
Joined: 02/21/2013
Posts: 45

Would it be possible to look at the source code for the SBSSHForwarding
Posted: 03/05/2013 09:05:00
by Ken Ivanov (Team)

Yes - registered users get access to the full source code of the components of the purchased package(s).
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages



Topic viewed 15018 times

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


Back to top

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

Got it!