Closed
Description
using Socket listener = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
listener.Bind(new IPEndPoint(IPAddress.IPv6Loopback, 0));
listener.Listen(10);
using Socket client = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
client.Bind(new IPEndPoint(IPAddress.IPv6Loopback, 0));
_ = client.ConnectAsync(listener.LocalEndPoint);
using Socket server = listener.Accept();
Console.WriteLine($"listener: {listener.DualMode} | client: {client.DualMode} | server:{server.DualMode}");
The code above will print listener: False | client: False | server:False
on Linux and Windows, but listener: False | client: False | server:True
on Mac.
Since we don't do anything special in our code, I assume the OS is creating an IPV6_V6ONLY == 0
accept socket despite the listener being IPV6_V6ONLY == 1
.
We may want to alter the socket option in our PAL for consistency.