Better socket error handling
Fixed SocketDisconnect; fixed compiler warnings