Using ServerSocket class (page 2)

* * ... Continuation from page 1 * * Then we arrange an indefinite loop listening for client requests * * When a client sends a request-message to the specified host and port number * server program accepts this request with accept method * that returns client socket established on the server side for this connection. * * Then, we can open input/output streams to the socket. * We use Filter Streams in the example allowing us to simplify the code * by directly working with strings, not bytes. * It is expected that the same type of streams are open on the client side. * * We read a string of a client request from the input stream * and call serviceMethod(clientRequest) method to provide a service. * * The service is very simple: we just return input string. * But in real world it could be sophisticated analysis of client request * with plenty of calls to different method-services. * * Then we send response string back to the client using PrintStream. * * We close the client connection, but keep alive the server socket * * That's the end of the while loop, so the program is back expecting * another client request to accept. **/ Back To Java Networking