diff --git a/deliverables/src/MV3500Cohort2018JulySeptember/homework2/Loeffelman/LoeffelmanAssigment2ScreenShots.pptx b/deliverables/src/MV3500Cohort2018JulySeptember/homework2/Loeffelman/LoeffelmanAssigment2ScreenShots.pptx new file mode 100644 index 0000000000000000000000000000000000000000..0f0a8e048387c3c4cccc16c2ba6df3f63ee34b19 Binary files /dev/null and b/deliverables/src/MV3500Cohort2018JulySeptember/homework2/Loeffelman/LoeffelmanAssigment2ScreenShots.pptx differ diff --git a/deliverables/src/MV3500Cohort2018JulySeptember/homework2/Loeffelman/LoeffelmanAssignment2_UML.pptx b/deliverables/src/MV3500Cohort2018JulySeptember/homework2/Loeffelman/LoeffelmanAssignment2_UML.pptx new file mode 100644 index 0000000000000000000000000000000000000000..b437fbf3d4aec60553fe2631042aab8690e38efe Binary files /dev/null and b/deliverables/src/MV3500Cohort2018JulySeptember/homework2/Loeffelman/LoeffelmanAssignment2_UML.pptx differ diff --git a/deliverables/src/MV3500Cohort2018JulySeptember/homework2/README.md b/deliverables/src/MV3500Cohort2018JulySeptember/homework2/README.md index c16552e9cd7cc83b96e35f523a821f4d98bbcee0..a95fb812634805196b9f83636cf38d4173f0714c 100644 --- a/deliverables/src/MV3500Cohort2018JulySeptember/homework2/README.md +++ b/deliverables/src/MV3500Cohort2018JulySeptember/homework2/README.md @@ -4,7 +4,14 @@ Deliverables: 0. Think of a simple challenge/response protocol that you wish to portray. 1. Apply your own customized version of Assignment 3 showing both Server and Client programs. -2. Include comments describing your modifications. + 1. Challenge/response scenarios + 2. IPv4 versus IPv6 + 3. Joke telling and riddles? + 4. [Message of the Day (MOTD)](https://en.wikipedia.org/wiki/Motd_(Unix)) + 5. Variations on a theme, protocol handshaking + 6. Connecting two different hosts - chat + 7. Something for your thesis! +2. Include comments describing your modifications (aka Documentation). 3. Include documentation of one or more sessions, including operation. 4. Create a simple illustration of the communications exchange in a UML Sequence Diagram. diff --git a/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java b/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java index 2e804a4408ec3205eaf30243e7a83be80734e41d..ff2dbb3d9b7714fe12daf1d0cf1e30758851bbba 100644 --- a/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java +++ b/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java @@ -20,7 +20,7 @@ public class TcpClient { public static void main(String[] args) { try { while (true) { - System.out.println("creating socket"); + System.out.println("TcpClient creating socket..."); // We request an IP to connect to ("localhost") and // port number at that IP (2317). This establishes @@ -29,13 +29,14 @@ public class TcpClient { // connections. Socket socket = new Socket(LOCALHOST, 2317); // locohost? + // Now hook everything up (i.e. set up the streams), Java style: + InputStream is = socket.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + // Read the single line written by the server. We'd // do things a bit differently if many lines to be read // from the server, instead of one only. - InputStream is = socket.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - String serverMessage = br.readLine(); System.out.println("=================================================="); System.out.println("Now we're talking!"); diff --git a/projects/TcpExample3/Server/TcpServer/src/tcpserver/TcpServer.java b/projects/TcpExample3/Server/TcpServer/src/tcpserver/TcpServer.java index 9d0ca372d12087b1bdc80a772144d7fd1be24826..b8a77f146cfa1fb4c7cebcf0e037e1b7da5ad317 100644 --- a/projects/TcpExample3/Server/TcpServer/src/tcpserver/TcpServer.java +++ b/projects/TcpExample3/Server/TcpServer/src/tcpserver/TcpServer.java @@ -31,17 +31,21 @@ public class TcpServer { // Notice that it is outside the loop; ServerSocket // needs to be made only once. + System.out.println("TcpServer has started..."); // it helps debugging to put this on console first ServerSocket serverSocket = new ServerSocket(2317); + // Server is up and waiting (i.e. "blocked" or paused) // Loop, infinitely, waiting for client connections. // Stop the program somewhere else. while (true) { - Socket clientConnection = serverSocket.accept(); // block until connected + Socket clientConnection = serverSocket.accept(); // block until connected to a client + + // Now hook everything up (i.e. set up the streams), Java style: OutputStream os = clientConnection.getOutputStream(); - PrintStream ps = new PrintStream(os); + PrintStream ps = new PrintStream(os); - ps.println("This was written by the server"); + ps.println("This was written by the server"); // this goes back to client! // Print some information locally about the Socket // connection. This includes the port and IP numbers