The problem is that there is no event that notifies you when the BoundPort property value is valid. If you check inside of the forwarding_OnOpen event it still has a zero value.

Ok so I threw in a work around of starting a timer.

I then dragged a timer from the standard windows component toolbox on to the form and created a tick event handler with a time period of one second. Which I then enabled inside of the forwarding_OpOpen event, something is very weird as this event never fires! This is a timer type of System.Windows.Forms.Timer.

I then added another timer of System.Timers.Timer to trigger inside of the forwarding_OnOpen event, along with a form button to enable the Forms.Timer object.

When my timers.timer object fires the BoundPort value is the correct port as reported by the SSH server.

In playing around with the example a timer type of Forms.Timer will never fire after an initial SSH connection has been made, even if it is shutdown!

Further Edit:

Dynamically assigned ports do not work! The port is reported correctly and opened by the server how ever it never gets reported as opened in your component or forwards any traffic. Hard assigned ports do work.

1) We've conducted some investigations and found out that dynamic-port remote forwarding functionality had been broken in one of the latest builds (I should stress that only applications which use *remote port forwarding* AND *request a dynamically assigned remote port number* are affected). We are working on the fix at the moment. The fix will be available in the future SecureBlackbox build update.

2) OnOpen fires right after SSH transport connection has been negotiated, and only reports that mutual authentication has succeeded and the component is ready to proceed to further steps of the communication (tunnel(s) set up). Please use OnTunnelOpen event to track the moment when the tunnel is ready. The real port number value is assigned to the BoundPort property by that moment.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.