From ee6c158f30522427dc47f043f56c9557c7c9a793 Mon Sep 17 00:00:00 2001 From: jonathanboron <jonathanboron@172.20.148.95> Date: Thu, 18 Jul 2019 13:20:58 -0700 Subject: [PATCH] Homework 1 v4 --- .../homework1/BoronTcpExample1Telnet1.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework1/BoronTcpExample1Telnet1.java b/assignments/src/MV3500Cohort2019JulySeptember/homework1/BoronTcpExample1Telnet1.java index 9d3bbdb3df..a38074ce5f 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework1/BoronTcpExample1Telnet1.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework1/BoronTcpExample1Telnet1.java @@ -36,6 +36,12 @@ public class BoronTcpExample1Telnet1 { try { + InetAddress ip; + String hostname; + + ip = InetAddress.getLocalHost(); + hostname = ip.getHostName(); + System.out.println("TcpExample1Telnet has started and is waiting for a connection."); System.out.println(" help: https://savage.nps.edu/Savage/developers.html#telnet"); System.out.println(" enter (telnet localhost 2317) or (nc localhost 2317)..." ); @@ -56,7 +62,8 @@ public class BoronTcpExample1Telnet1 Timestamp timestamp = new Timestamp(System.currentTimeMillis()); ps.println("This client response was written by Capt. Jonathan Boron."); // to remote clientnc - ps.println("Connection achieved at time: " + timestamp); + ps.println("Name/IP Address for host: " + ip); + ps.println("Connection achieved at date/time: " + timestamp); System.out.println("This server response was written by Capt. Jonathan Boron."); // to server console System.out.println("Connection achieved at time: " + timestamp); -- GitLab