Skip to content
Snippets Groups Projects
Commit 221026b6 authored by snapp's avatar snapp
Browse files

Updated AllenTcpExample3Client.java and AllenTcpExample3Server.java

in homework2 folder
parent 4db2652d
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,7 @@ import java.net.*;
* same string telnet printed, sent by the server. The output at the server will
* show different socket pairs for each time the loop iterates.
*
* @author mcgredo
* @author brutzman
* @author snapp
*/
public class AllenTcpExample3Client {
......@@ -59,10 +58,10 @@ public class AllenTcpExample3Client {
// from the server instead of one only.
serverMessage = br.readLine();
System.out.println("==================================================");
System.out.print ("Client loop " + clientLoopCount + ": ");
System.out.println("now we're talking!");
System.out.println("The message the server sent was: '" + serverMessage + "'");
System.out.println("Sorry, my dog ate my homework.");
System.out.println("The AllenServer responds with: " + serverMessage + "'");
System.out.println("Yeah, it took him a few bytes! This this my " + clientLoopCount +" time trying to contact you.");
// socket gets closed, either automatically/silently by this code (or possibly by the server)
Thread.sleep(500l); // slow things down, for example 500l (long) = 500 msec
......
......@@ -19,8 +19,7 @@ import java.net.*;
*
* and have the instructor display the socket pairs received.
*
* @author mcgredo
* @author brutzman
* @snapp
*/
public class AllenTcpExample3Server {
......@@ -58,7 +57,7 @@ public class AllenTcpExample3Server {
// Now hook everything up (i.e. set up the streams), Java style:
os = clientConnectionSocket.getOutputStream();
ps = new PrintStream(os);
ps.println("This is response " + serverLoopCount + " produced by the server."); // this gets sent back to client!
ps.println("This is response " + serverLoopCount + " produced by the server. Your dog ate your coding assignment?"); // this gets sent back to client!
// Print some information locally about the Socket connection.
// This includes the port and IP numbers on both sides (the socket pair).
......
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