/// (from System.Net.Sockets)
/// </summary>
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TcpClient()
{
// set up a listening Socket
}
[Test] // bug #81105
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseTest ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof(ArgumentNullException))]
+#endif
public void ConnectMultiNull ()
{
TcpClient client = new TcpClient ();
IPAddress[] ipAddresses = null;
- client.Connect (ipAddresses, 1234);
+ client.Connect (ipAddresses, NetworkHelpers.FindFreePort ());
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectMultiAny ()
{
TcpClient client = new TcpClient ();
ipAddresses[0] = IPAddress.Any;
try {
- client.Connect (ipAddresses, 1234);
+ client.Connect (ipAddresses, NetworkHelpers.FindFreePort ());
Assert.Fail ("ConnectMultiAny #1");
} catch (SocketException ex) {
Assert.AreEqual (10049, ex.ErrorCode, "ConnectMultiAny #2");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectMultiRefused ()
{
TcpClient client = new TcpClient ();
ipAddresses[0] = IPAddress.Loopback;
try {
- client.Connect (ipAddresses, 1234);
+ client.Connect (ipAddresses, NetworkHelpers.FindFreePort ());
Assert.Fail ("ConnectMultiRefused #1");
} catch (SocketException ex) {
Assert.AreEqual (10061, ex.ErrorCode, "ConnectMultiRefused #2");
Assert.Fail ("ConnectMultiRefused #3");
}
}
+
+ [Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+ public void ExclusiveAddressUse ()
+ {
+ using (TcpClient client = new TcpClient ()) {
+ client.ExclusiveAddressUse = false;
+ }
+ }
}
}