Browse Source

* SocketTest.cs: added test for bug #75158.

svn path=/trunk/mcs/; revision=45420
Gert Driesen 20 years ago
parent
commit
ce2cd9cf8b

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

@@ -1,3 +1,7 @@
+2005-06-04 Gert Driesen <[email protected]>
+
+	* SocketTest.cs: added test for bug #75158 (incompatible address).
+
 2005-06-04 Gert Driesen <[email protected]>
 
 	* SocketTest.cs: use IPAddress.Loopback in IPEndPoint to allow 

+ 26 - 0
mcs/class/System/Test/System.Net.Sockets/SocketTest.cs

@@ -47,6 +47,32 @@ namespace MonoTests.System.Net.Sockets
 			}
 		}
 
+		[Test]
+		[Ignore ("Bug #75158")]
+		public void IncompatibleAddress ()
+		{
+			IPEndPoint epIPv6 = new IPEndPoint (IPAddress.IPv6Any,
+								0);
+
+			try {
+				using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)) {
+					s.Connect (epIPv6);
+					s.Close ();
+				}
+				Assert.Fail ("#1");
+			} catch (SocketException ex) {
+#if !NET_2_0
+				// invalid argument
+				int expectedError = 10022;
+#else
+				// address incompatible with protocol
+				int expectedError = 10047;
+#endif
+				Assert.AreEqual (expectedError, ex.ErrorCode,
+						"#2");
+			}
+		}
+
 		[Test]
 		[Category ("InetAccess")]
 		public void EndConnect ()