In this example, we will walk you through a simple echo server example using UDP. An echo server (as is the same with our previous chapters) echoes any input to its output. In the case of this UDP example, the server echoes data sent to it from a client back to the client. To keep the example simple, character buffers will be echoed. How to properly process structured packets will be covered in the following examples.
Studying an example on the UDP echo server
Server
To start, we must define the maximum buffer size we plan to send from the client to the server and back, and we must also define the port we wish to use:
#define PORT 22000
#define MAX_SIZE 0x10
It should be noted that any port number will do so long as it is above...