Daemon

A deamon is a process that is permanently listening for incoming requests for a particular service. By definition it can handle several requests in parallel by giving every client its own data transport channel and corresponding thread.


The example shows how the daemon sets up a listening socket for accepting connections from clients. Every time a client tries to connect and the listening socket accepts the call, a new socket is created by the accept() call and the main thread creates a new thread which takes over the communication with the client using the newly created socket. The main thread will then continue to listen for new requests.

C++ Source:
daemon.cpp