In Chapter 2, Getting to Grips with Socket APIs, we implemented a simple TCP server that served a web page with HTTP. In this chapter, we will begin by implementing a TCP client. This client is able to establish an IPv4 or IPv6 TCP connection with any listening TCP server. It will be a useful debugging tool that we can reuse in the rest of this book.
Our TCP server from the last chapter was limited to accepting only one connection. In this chapter, we will look at multiplexing techniques to allow our programs to handle many separate connections simultaneously.
The following topics are covered in this chapter:
- Configuring a remote address with getaddrinfo()
- Initiating a TCP connection with connect()
- Detecting terminal input in a non-blocking manner
- Multiplexing with fork()
- Multiplexing with select()
- Detecting peer disconnects
- Implementing...