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 uses EchoServer1 and EchoClient1, which uses connectionless datagram sockets for the Echo service.

Compile Echo*1.java (“javac Echo*1.java”). Then:

A sample session is attached.
The server waits for a message from any client. When it receives a message that is not an ending message (one that contains a single dot), it sends the same message back to the sender, using the return address extracted from the datagram packet. The client repeated prompts for input from the user. Each line is sent to the server, then the message (the echo) subsequently received from the server is displayed to the user. When the user enters an ending line (one that contains a single dot), the session is over after the echo is received.
>java EchoServer1 12345
Echo server ready.
Request received
message received: hello

Request received
message received: how goes?

Request received
message received: Happy day.

>java EchoClient1 Welcome to the Echo client.
What is the name of the server host?
localhost
What is the port number of the server host?
12345
Enter a line to receive an echo back from the server, or a single peroid to quit
.
hello
hello

Enter a line to receive an echo back from the server, or a single peroid to quit
.
how goes?
how goes?

Enter a line to receive an echo back from the server, or a single peroid to quit
.
Happy day.
Happy day.

Enter a line to receive an echo back from the server, or a single peroid to quit
.
.

Computer Science & Information Technology

You might also like to view...

The term, garbage collection, refers to cleaning up, or reclaiming, memory that is reserved by a program.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Find the x- and y-intercepts of the equation and use them to sketch the graph.

A.
x-intercept , y-intercept

B.
x-intercept , y-intercept

C.
x-intercept , y-intercept

D.
x-intercept , y-intercept none

E.
x-intercept , y-intercept

Computer Science & Information Technology