Question: Modify the socket-based date server (Figure 3.27) in Chapter 3 so that the server services each client request in a separate thread. import java.net.*; import

 Modify the socket-based date server (Figure 3.27) in Chapter 3 so

Modify the socket-based date server (Figure 3.27) in Chapter 3 so that the server services each client request in a separate thread.

import java.net.*; import java.io.*; public class DateServer { public static void main(String[] args) { try { Server Socket sock = new ServerSocket (6013); /* now listen for connections */ while (true) { Socket client = sock.accept(); PrintWriter pout = new PrintWriter (client.getOutputStream(), true); /* write the Date to the socket / pout.println(new java.util.Date().toString(); /* close the socket and resume */ /* listening for connections / client.close(); } catch (IOException ioe) { System.err.println(ice); } > } Figure 3.27 Date server

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!