From 633d97a92b0df0b88fc30ff6bde26058d62495f5 Mon Sep 17 00:00:00 2001
From: brutzman <brutzman@nps.edu>
Date: Tue, 23 Jul 2024 11:56:47 -0700
Subject: [PATCH]  add diagnostic for host name, note this might only show up
 for your system's telnet connection since hostnames aren't part of TCP

---
 examples/src/TcpExamples/TcpExample2ConnectionCounting.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/src/TcpExamples/TcpExample2ConnectionCounting.java b/examples/src/TcpExamples/TcpExample2ConnectionCounting.java
index 03bb12bddf..f6345f57e4 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)
-- 
GitLab