The final example in this chapter will build upon our existing debugger example to add support for multiple clients. In Chapter 10, Programming POSIX Sockets Using C++, we added support for networking to the example debugger, providing the ability to offload our debugging logs to a server in addition to the local system.
The problem with this is that the server could only accept one connection before closing, as it didn't have the logic for handling more than one client. In this example, we will fix that issue.
To start, we will need to define our port and max debug string length, as follows:
#define PORT 22000
#define MAX_SIZE 0x1000
The server will require the following include statements:
#include <array>
#include <unordered_map>
#include <sstream>
#include <fstream>
#include <iostream>
#include <mutex>...