@@ -556,10 +556,13 @@ - (int)fileDescriptorForReading { #ifndef _WIN32 return _socket; #else + if (_socket == INVALID_SOCKET) + return -1; + if (_socket > INT_MAX) @throw [OFOutOfRangeException exception]; return (int)_socket; #endif @@ -568,10 +571,13 @@ - (int)fileDescriptorForWriting { #ifndef _WIN32 return _socket; #else + if (_socket == INVALID_SOCKET) + return -1; + if (_socket > INT_MAX) @throw [OFOutOfRangeException exception]; return (int)_socket; #endif