aboutsummaryrefslogtreecommitdiffstats
path: root/java/com/tigervnc/network/TcpSocket.java
diff options
context:
space:
mode:
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() {