@@ -134,10 +134,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 @@ -146,10 +149,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