Refactor winsock communication code into classes