diff options
Diffstat (limited to 'java/com/tigervnc/vncviewer/CConn.java')
-rw-r--r-- | java/com/tigervnc/vncviewer/CConn.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java index 3aee46d5..75f6b74b 100644 --- a/java/com/tigervnc/vncviewer/CConn.java +++ b/java/com/tigervnc/vncviewer/CConn.java @@ -128,15 +128,20 @@ public class CConn extends CConnection implements int localPort = TcpSocket.findFreeTcpPort(); if (localPort == 0) throw new Exception("Could not obtain free TCP port"); - Tunnel.createTunnel(this, localPort); + String gatewayHost = Tunnel.getSshHost(); + if (gatewayHost.isEmpty()) + gatewayHost = getServerName(); + Tunnel.createTunnel(gatewayHost, getServerName(), + getServerPort(), localPort); sock = new TcpSocket("localhost", localPort); + vlog.info("connected to localhost port "+localPort); } else { sock = new TcpSocket(getServerName(), getServerPort()); + vlog.info("connected to host "+getServerName()+" port "+getServerPort()); } } catch (java.lang.Exception e) { throw new Exception(e.getMessage()); } - vlog.info("connected to host "+getServerName()+" port "+getServerPort()); } else { String name = sock.getPeerEndpoint(); if (listenMode.getValue()) |