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
.
.
You might also like to view...
In Excel, ________ are prewritten formulas that are used to solve mathematical problems or manipulate text fields
A) formulas B) calculations C) equations D) functions
DHTML stands for ________
Fill in the blank(s) with correct word
A _____ resembles a group of computers in which data flows in only one direction from one device to the next.
A. hierarchical network B. star network C. bus network D. ring network
Computer software is divided into two broad categories: system software and application development software.
Answer the following statement true (T) or false (F)