Ver Fonte

2009-06-27 Gonzalo Paniagua Javier <[email protected]>

	* Socket.cs: turn WSAEINVAL into ArgumentException.


svn path=/trunk/mcs/; revision=137031
Gonzalo Paniagua Javier há 16 anos atrás
pai
commit
16d1a86aac

+ 4 - 0
mcs/class/System/System.Net.Sockets/ChangeLog

@@ -1,3 +1,7 @@
+2009-06-27 Gonzalo Paniagua Javier <[email protected]>
+
+	* Socket.cs: turn WSAEINVAL into ArgumentException.
+
 2009-06-26 Gonzalo Paniagua Javier <[email protected]>
 
 	* Socket.cs: MS throws a SocketException in the byte[] overload when

+ 12 - 3
mcs/class/System/System.Net.Sockets/Socket.cs

@@ -3038,8 +3038,11 @@ namespace System.Net.Sockets
 			SetSocketOption_internal(socket, level, name, null,
 						 opt_value, 0, out error);
 
-			if (error != 0)
+			if (error != 0) {
+				if (error == 10022) // WSAEINVAL
+					throw new ArgumentException ();
 				throw new SocketException (error);
+			}
 		}
 
 		public void SetSocketOption (SocketOptionLevel level, SocketOptionName name, object opt_value)
@@ -3073,8 +3076,11 @@ namespace System.Net.Sockets
 				SetSocketOption_internal (socket, level, name, opt_value, null, 0, out error);
 			}
 
-			if (error != 0)
+			if (error != 0) {
+				if (error == 10022) // WSAEINVAL
+					throw new ArgumentException ();
 				throw new SocketException (error);
+			}
 		}
 
 #if NET_2_0
@@ -3086,8 +3092,11 @@ namespace System.Net.Sockets
 			int error;
 			int int_val = (optionValue) ? 1 : 0;
 			SetSocketOption_internal (socket, level, name, null, null, int_val, out error);
-			if (error != 0)
+			if (error != 0) {
+				if (error == 10022) // WSAEINVAL
+					throw new ArgumentException ();
 				throw new SocketException (error);
+			}
 		}
 #endif