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.
daemon.cpp