Compile CounterServer1.java and CounterClient1.java (“javac Counter*.java”). Run the server, then a client several times. Does the counter increase with each client?

This exercise deals with stateful servers that maintain global state information.


Yes, the counter does increase with each client, as illustrated in the following sample run script.
```
>java CounterClient1
Welcome to the Counter client.
What is the name of the server host?
localhost
What is the port number of the server host?
12345
Message received: 1

Here is the counter received from the server: 1

>java CounterClient1
Welcome to the Counter client.
What is the name of the server host?
localhost
What is the port number of the server host?
12345
Message received: 2

Here is the counter received from the server: 2
>java CounterClient1
Welcome to the Counter client.
What is the name of the server host?
localhost
What is the port number of the server host?
12345
Message received: 3

Here is the counter received from the server: 3
```

Computer Science & Information Technology

You might also like to view...

Most galleries support the sneak peek feature, as shown in the accompanying figure.

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

Computer Science & Information Technology

If you have a right-aligned paragraph and you want to make it left-aligned, click the Align Text Left button.

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

Computer Science & Information Technology

?WDM divides a beam of light into how many different wavelengths or colors?

A. ?10 B. ?20 C. ?30 D. ?40

Computer Science & Information Technology

Explain the different roles of an event method based on whether the parentheses are empty.?

What will be an ideal response?

Computer Science & Information Technology