Skip to content
Snippets Groups Projects
Commit ee6c158f authored by jonathanboron's avatar jonathanboron
Browse files

Homework 1 v4

parent 75dab3d3
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,12 @@ public class BoronTcpExample1Telnet1 ...@@ -36,6 +36,12 @@ public class BoronTcpExample1Telnet1
{ {
try 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("TcpExample1Telnet has started and is waiting for a connection.");
System.out.println(" help: https://savage.nps.edu/Savage/developers.html#telnet"); System.out.println(" help: https://savage.nps.edu/Savage/developers.html#telnet");
System.out.println(" enter (telnet localhost 2317) or (nc localhost 2317)..." ); System.out.println(" enter (telnet localhost 2317) or (nc localhost 2317)..." );
...@@ -56,7 +62,8 @@ public class BoronTcpExample1Telnet1 ...@@ -56,7 +62,8 @@ public class BoronTcpExample1Telnet1
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ps.println("This client response was written by Capt. Jonathan Boron."); // to remote clientnc 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("This server response was written by Capt. Jonathan Boron."); // to server console
System.out.println("Connection achieved at time: " + timestamp); System.out.println("Connection achieved at time: " + timestamp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment