diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/com/tigervnc/network/TcpListener.java | 6 | ||||
-rw-r--r-- | java/com/tigervnc/network/TcpSocket.java | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/java/com/tigervnc/network/TcpListener.java b/java/com/tigervnc/network/TcpListener.java index 6170a602..45ee8a4d 100644 --- a/java/com/tigervnc/network/TcpListener.java +++ b/java/com/tigervnc/network/TcpListener.java @@ -144,9 +144,9 @@ public class TcpListener extends SocketListener { return s; } - //public int getMyPort() { - // return TcpSocket.getSockPort(); - //} + public int getMyPort() { + return ((SocketDescriptor)getFd()).socket().getLocalPort(); + } private boolean closeFd; private ServerSocketChannel channel; diff --git a/java/com/tigervnc/network/TcpSocket.java b/java/com/tigervnc/network/TcpSocket.java index 051a9d82..43787e4d 100644 --- a/java/com/tigervnc/network/TcpSocket.java +++ b/java/com/tigervnc/network/TcpSocket.java @@ -113,8 +113,7 @@ public class TcpSocket extends Socket { } public int getMyPort() { - SocketAddress address = ((SocketDescriptor)getFd()).socket().getLocalSocketAddress(); - return ((InetSocketAddress)address).getPort(); + return getSockPort(); } public String getPeerAddress() { @@ -184,7 +183,7 @@ public class TcpSocket extends Socket { } public int getSockPort() { - return ((InetSocketAddress)((SocketDescriptor)getFd()).socket().getRemoteSocketAddress()).getPort(); + return ((SocketDescriptor)getFd()).socket().getLocalPort(); } /* Tunnelling support. */ |