ShadowOptions so = EnsureShadowValuesInitialized();
so._exclusiveAddressUse = value ? 1 : 0;
so._exclusiveAddressUseInitialized = true;
- if (_clientSocket != null)
- {
- _clientSocket.ExclusiveAddressUse = value; // Use setter explicitly as it does additional validation beyond that done by SetOption
- }
+
+ Socket s = _clientSocket ?? CreateSocket();
+ s.ExclusiveAddressUse = value; // Use setter explicitly as it does additional validation beyond that done by SetOption
}
}
}
[Fact]
+ [PlatformSpecific(PlatformID.Windows)]
public void Roundtrip_ExclusiveAddressUse_GetEqualsSet()
{
using (TcpClient client = new TcpClient())
}
[Fact]
+ [PlatformSpecific(PlatformID.AnyUnix)]
+ public void ExclusiveAddressUse_NotSupported()
+ {
+ using (TcpClient client = new TcpClient())
+ {
+ Assert.Throws<SocketException>(() => client.ExclusiveAddressUse);
+ Assert.Throws<SocketException>(() =>
+ {
+ client.ExclusiveAddressUse = true;
+ });
+ }
+ }
+
+ [Fact]
public void Roundtrip_LingerOption_GetEqualsSet()
{
using (TcpClient client = new TcpClient())