June 2004
Intermediate to advanced
848 pages
21h 28m
English
There's one improvement that is customary in servers, and we will make it here. For all but the smallest of servers, it is usual to spawn a new thread to handle each request. This has three big advantages:
Foremost, it makes the server scalable. The server can accept new requests independent of its speed in handling them. (Of course, you need to run a server that has the mippage to keep up with requests.)
By handling each request in a new thread, clients do not have to wait for every request ahead of them to be served.
The program source can be better organized, as the server processing is written in a different class.
The following code demonstrates how we would modify our HTTP web server to a new thread ...
Read now
Unlock full access