Assert.IsTrue (mre.WaitOne (1000), "ConnectedAsync timeout");
}
+
+ [Test] // Covers https://bugzilla.xamarin.com/show_bug.cgi?id=52549
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+ public void SocketMismatchProtocol ()
+ {
+ try {
+ using (Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Tcp));
+ Assert.Fail ("#1");
+ } catch (SocketException e) {
+ // Only work on OSX
+ // Assert.AreEqual(SocketError.ProtocolType, e.SocketErrorCode, "#2");
+ }
+
+ try {
+ using (Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Udp));
+ Assert.Fail ("#3");
+ } catch (SocketException e) {
+ // Only work on OSX
+ // Assert.AreEqual(SocketError.ProtocolType, e.SocketErrorCode, "#4");
+ }
+ }
}
}
#define WSAENOTSOCK 10038
#define WSAEDESTADDRREQ 10039
#define WSAEMSGSIZE 10040
+#define WSAEPROTOTYPE 10041
#define WSAENOPROTOOPT 10042
#define WSAEPROTONOSUPPORT 10043
#define WSAESOCKTNOSUPPORT 10044
case ENETDOWN: return WSAENETDOWN;
#endif
case ENODEV: return WSAENETDOWN;
+#ifdef EPROTOTYPE
+ case EPROTOTYPE: return WSAEPROTOTYPE;
+#endif
default:
g_error ("%s: no translation into winsock error for (%d) \"%s\"", __func__, error, g_strerror (error));
}