Remove unnecessary checks of hSocket, and merge a declaration and initialization.