aboutsummaryrefslogtreecommitdiffstats
path: root/java/com/tigervnc/network/TcpSocket.java
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2012-04-26 00:03:16 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2012-04-26 00:03:16 +0000
commit9dd057bb0f981c65a372ee4346bc0bb034d01d24 (patch)
tree262f0fb65cddce79712a710eb6cb3e7c6b5241f1 /java/com/tigervnc/network/TcpSocket.java
parent5be8fa01edeb1e09a60cedcc400f48cea97f497b (diff)
downloadtigervnc-9dd057bb0f981c65a372ee4346bc0bb034d01d24.tar.gz
tigervnc-9dd057bb0f981c65a372ee4346bc0bb034d01d24.zip
Fix Socket methods for querying the socket endpoints. Fix the address displayed in the info dialog for redirected connections.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4902 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/com/tigervnc/network/TcpSocket.java')
-rw-r--r--java/com/tigervnc/network/TcpSocket.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/java/com/tigervnc/network/TcpSocket.java b/java/com/tigervnc/network/TcpSocket.java
index 9672fe5e..c4c1a8cf 100644
--- a/java/com/tigervnc/network/TcpSocket.java
+++ b/java/com/tigervnc/network/TcpSocket.java
@@ -118,15 +118,22 @@ public class TcpSocket extends Socket {
}
public String getPeerAddress() {
- SocketAddress peer = ((SocketDescriptor)getFd()).socket().getRemoteSocketAddress();
+ InetAddress peer = ((SocketDescriptor)getFd()).socket().getInetAddress();
if (peer != null)
- return peer.toString();
+ return peer.getHostAddress();
+ return "";
+ }
+
+ public String getPeerName() {
+ InetAddress peer = ((SocketDescriptor)getFd()).socket().getInetAddress();
+ if (peer != null)
+ return peer.getHostName();
return "";
}
public int getPeerPort() {
- SocketAddress address = ((SocketDescriptor)getFd()).socket().getRemoteSocketAddress();
- return ((InetSocketAddress)address).getPort();
+ int port = ((SocketDescriptor)getFd()).socket().getPort();
+ return port;
}
public String getPeerEndpoint() {