May 2019
Intermediate to advanced
478 pages
11h 21m
English
Programming a UDP server is a bit different than TCP. TCP requires managing a socket for each peer connection. With UDP, our program only needs one socket. That one socket can communicate with any number of peers.
While the TCP program flow required us to use listen() and accept() to wait for and establish new connections, these functions are not used with UDP. Our UDP server simply binds to the local address, and then it can immediately start sending and receiving data.
The program flow of a TCP Server compared to a UDP Server is as follows:

With either a TCP or UDP server, we use select() when we need to check/wait for ...
Read now
Unlock full access