Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Resolved (Case 1390358) IPv6.Any bound NetworkDriver cannot accept connection from IPv4 endpoint

Discussion in 'Unity Transport' started by Kichang-Kim, Dec 23, 2021.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    831
    Hi. As a title said, IPv6 bound NetworkDriver cannot accept connection from IPv4 endpoint.

    This is clearly different behaviour to legacy LLAPI. With LLAPI, IPv6.Any bound NetworkTransport can accept connection from IPv4 endpoint without any problems.

    Reported as Case 1390358.
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    101
    I'd argue that it's the LLAPI behavior that is wrong here, but I understand how this might be seen as a regression. Nonetheless, we don't intend to emulate this behavior in Unity Transport.

    A driver can only bind to a single address (of a single family). It should be seen as thin abstraction over a socket (which is what it really is), and sockets can't bind to multiple addresses. If one wants to accept connections for both IPv4 and IPv6, using two drivers is how it should be done.
     
    Kichang-Kim likes this.
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    831
    I resolved this by implementing two drivers in my code. Thanks for reply.

    Small feedbacks:
    I implemented internal socket map by using Dictionary<NetworkConnection, MyOtherClass>, but NetworkConnection does not implement IEquatable<NetworkConnection> so it makes unneeded GC. I think it can be easily resolved by adding IEquatable to NetworkConnection.

    I created new post about this:
    https://forum.unity.com/threads/makes-networkconnection-be-iequatable-networkconnection.1225905/
     
unityunity