This program is complimentary to Hello TCP Server program, you can run either of them to check the validity of each other. The program flow is quite common with Hello TCP server, so make sure to take a look at that too.
Here's the code -
#include <cstring>
#include <iostream>
#includ...