Socket Client code improvements

Client now can handle large amounts of data from the server and the GUI
will process windows events while receiving large amounts of data.
Cleaned up the receive loop code and simplified the loop condition.