To demonstrate something more useful, the following example implements the same logger that we have been developing throughout this book, but as a remote logging facility.
Exploring an example on TCP Logger
Server
The same macros and includes are needed for this example as with the previous examples in this chapter. To start the server, we must define the log file:
std::fstream g_log{"server_log.txt", std::ios::out | std::ios::app};
Since the logger will be executing on the same computer to keep the example simple, we will name the file the server is logging to as server_log.txt.
The server is identical to the TCP server in the previous example, with the exception that only a recv() member function is needed (that...