diff --git a/examples/src/TcpExamples/TcpExample2ConnectionCounting.java b/examples/src/TcpExamples/TcpExample2ConnectionCounting.java index 03bb12bddf406940c04d9763e73019de97ddbb30..f6345f57e41c954a8b0bd99eb72554ba9e887663 100644 --- a/examples/src/TcpExamples/TcpExample2ConnectionCounting.java +++ b/examples/src/TcpExamples/TcpExample2ConnectionCounting.java @@ -98,8 +98,11 @@ public class TcpExample2ConnectionCounting // // Where are we? In other words, what is our host number? Advertise it. // // Note that we use the serverSocket to get address, since host may have multiple network connections. // // https://stackoverflow.com/questions/9481865/getting-the-ip-address-of-the-current-machine-using-java -// String localHostAddress = clientConnection.getInetAddress().getHostAddress(); +// String localHostAddress = clientConnectionSocket.getInetAddress().getHostAddress(); // System.out.println("Local host address is " + localHostAddress); +// // add diagnostic for host name, note this might only show up for your system's telnet connection since hostnames aren't part of TCP +// String localHostName = clientConnectionSocket.getInetAddress().getHostName(); +// System.out.println("Local host name is " + localHostName); // if (localHostAddress.contains("/")) // localHostAddress = localHostAddress.substring(localHostAddress.indexOf("/")+1); // // show localhost IP number to facilitate connections over local area network (LAN, WAN)