In this chapter, you will learn how to program POSIX sockets using C++17, including more common C++ paradigms, such as Resource Aquisition Is Initialization (RAII). To begin with, this chapter will discuss what a socket is, and the difference between UDP and TCP. The POSIX APIs will be explained in detail prior to walking you through five different examples. The first example will step you through programming with POSIX sockets by creating a UDP echo server example. The second example will create this same example using TCP instead of UDP and explain the differences. The third example will expand upon our existing debug logger that has been created in previous chapters, while the fourth and fifth examples will explain how to safely process a packet.
In this chapter, we will cover the following topics:
- POSIX sockets
- Leveraging C++ and RAII...