C++ server code

Latest master merged in. We should discuss the layout of the code.
See http://en.cppreference.com/w/cpp/types/size_t for the purpose of size_t. It is an unsigned integer type that is guaranteed to hold the maximum size of an array. Since a C-string is a char , size_t is guaranteed to be able to store all possible sizes of C-strings. Also, because it is unsigned it prevents passing in negative values (at least the compiler will raise a warning).