Changeset 385


Ignore:
Timestamp:
Aug 4, 2022, 12:56:59 AM (11 days ago)
Author:
alloc
Message:

Fixed HttpListener running the IPv6 socket in dual mode on some platforms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements2/SpaceWizards.HttpListener/src/System/Net/Managed/HttpEndPointListener.cs

    r377 r385  
    6767            _endpoint = new IPEndPoint(addr, port);
    6868            _socket = new Socket(addr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
     69
     70            if (addr.AddressFamily == AddressFamily.InterNetworkV6) {
     71                // Make sure that all platforms behave the same for IPv6 sockets (at least Linux by
     72                // default has them in dual mode, so it would conflict with the explicit IPv4 socket)
     73                _socket.DualMode = false;
     74            }
     75
    6976            _socket.Bind(_endpoint);
    7077            _socket.Listen(500);
Note: See TracChangeset for help on using the changeset viewer.