Rewrote the server program in C++ from Beej's programming guide