Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Appendix A. Concurrency II - Pg. 317

Appendix A Concurrency II by Brett L. Schuchert This appendix supports and amplifies the Concurrency chapter on page 177. It is written as a series of independent topics and you can generally read them in any order. There is some duplication between sections to allow for such reading. Client/Server Example Imagine a simple client/server application. A server sits and waits listening on a socket for a client to connect. A client connects and sends a request. The Server Here is a simplified version of a server application. Full source for this example is avail- able starting on page 343, Client/Server Nonthreaded. ServerSocket serverSocket = new ServerSocket(8009); while (keepProcessing) { try { Socket socket = serverSocket.accept(); process(socket); } catch (Exception e) { handle(e); } } 317