Run SocketServer.java and leave it running - it waits forever for requests
Run SocketClientSingleThreaded.java. This should send a message to your server. Check the output window to ensure it works
Look at the code in these files to make sure you understand what is going on
Complete the Socket Client
Open SocketClientMultithreaded.java and read the code
The // TO DO comments point you to where you need to insert code to initialize the CyclicBarrier, create the client threads and implement the barrier synchronization
You also need to insert the CyclicBarrier handling into SocketClientThread.java
Run the code. You should see multiple requests being processed by the server.
Run this test a few times. What is the maximum numbers of active servers you see?
Modify the server to use a thread pool
The server right now creates a thread per request. What do you think will happen if you create 100’s or 1000’s of simultaneous clients? Your laptop might not have enough resources to test this, but you should be able to guess :)
Create a new server that utilizes a FIXED SIZE thread pool. Make a sensible guess how large this pool should be (e.g. 20?)
In the client, tale two timestamps, one before any threads run and one after all threads complete. Print out the wall time (test duration) in milliseconds before exiting
Experiment with different nimbers of clients and thread pool sizes. Do you see much variation in the wall time for a test?
Compare the performance of the system with the original server and your modified server? Is there a noticable difference in performance?
Modify the code to use UDPs
Look at the UDP examples here and create a new version of your client-server that utilizes datagrams
Compare the wall times for the two versions. Do you see a significant difference?
If you want to look at some solutions, they are here
If you want to know more, a good comprehensive overview of Java sockets programming is here.
Armed with this knowledge you could for example modify the client and server to reuse a single socket to send a series of requests rather than creating a new socket each time.