Run the programs by starting the server (don’t forget to specify a port number as a command-line argument) first, then the client. Conduct a session and observe the diagnostic messages displayed on both sides. Describe your observation of the sequence of events.
This exercise deals with EchoServer2 and EchoClient2. Recall that EchoServer2 is connection-oriented and iterative.
Compile Echo*2.java (“javac Echo*2.java”). Then:
The sequence of events is similar to that for Echo*1.java. However, in this case the server waits for a connection (as opposed to a message). Once a connection is accepted, it listens for and echoes each message received, ending the session when the ending message (“.”) is received.
The client first issues a connection request (when a Socket object is instantiated), then prompts for input from the user. Each input line is sent to the server, and the message subsequently received from the server is displayed. again ending the session when the ending message (“.”) is received.
A sample session is attached.
>java EchoServer2 12345
Daytime server ready.
Waiting for a connection.
connection accepted
message received: abc
message received: hoo -h oo
message received: .
Session over.
Waiting for a connection.
>java EchoClient2
Welcome to the Echo client.
What is the name of the server host?
localhost
What is the port number of the server host?
12345
Connection made
Enter a line to receive an echo back from the server, or a single peroid to quit
.
abc
abc
Enter a line to receive an echo back from the server, or a single peroid to quit
.
hoo -h oo
hoo -h oo
Enter a line to receive an echo back from the server, or a single peroid to quit
.
.
You might also like to view...
A ________ is a visual representation of a process, including the decisions that need to be made along the way
A) structure chart B) critical path chart C) data-flow diagram D) flowchart
One of the challenges when using a(n) ____________________ argument in a dialectic about hacking is that it is sometimes difficult to predict consequences with any accuracy.
Fill in the blank(s) with the appropriate word(s).
Which of the following loops cannot be nested in a For loop?
a. While b. For c. Repeat ... Until d. Do ... While e. all of the above can be nested in a For loop
You can create vector drawings by combining several shapes within a rectangular area called a(n) drawing area.
Answer the following statement true (T) or false (F)