The best way to truly understand the use of the methods and functions described previously is to see them in action in a sample program. In this section, we will build an echo server as our starting example. This server, as the term suggests, sends whatever it received from each client back to the client. Through this example, you will learn how to set up a functional server, as well as how to handle client connections and data from it, and we will build more complex servers in later sections.
Before we jump into the code, however, let's discuss the structure of the program that will implement the communication logic for this server. First, we will have what is called the reactor, which sets up the server itself ...