Optimize RecvData wrapper
recv() is a system call, which has relatively high overhead.  You should avoid calling recv() just to read one byte at a time.  Instead, read a reasonable sized buffer (something like the size of an IP packet).  Your wrapper object should maintain a buffer of bytes that have been returned by a previous call to recv() but that have not yet been returned to the caller (bytes after a newline character).

In implementing such a buffered interface, you would be forced to use the return value of recv() correctly.  recv() returns the number of bytes read, or -1 if an error occurred.  The error code is stored in the errno global variable, not the return value of recv().