Hello,

I was wondering if it is possible to determine if a port forward already
exists on a specific port.  For example, I'm creating a port forward on
application startup with:

JSch jsch = new JSch();
session = jsch.getSession(user, host, port);
session.setPassword(password);
localUserInfo lui = new localUserInfo();
session.setUserInfo(lui);
session.connect();
session.setPortForwardingL(tunnelLocalPort, tunnelRemoteHost,
tunnelRemotePort);

Now, I have other processes that need to check if the forwarding/tunnel
already exists, but it seems like I can only do this by:

1. creating a new JSch session
2. calling session.connect
3. trying to create the port forwarding
4. catching the exception thrown (BindException: address already in use)
5. assume the tunnel already exists when getting this exception

Is there a better way to do this?  For example, is there a static class to
use that can check if the port forwarding exists on a specified port,
tunnelLocalPort?

Thanks in advance.

-Kiran
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to