added a checkError function to ClientSocket.cpp