SetSocketOption for ipv6 is crashing

I have a problem with udp sockets for ipv6.

I have this c# code:

//lots of other code here
             try
                {
                    udpSocketIPv6.SetSocketOption(
                        SocketOptionLevel.IPv6,
                        SocketOptionName.AddMembership,
                        new IPv6MulticastOption(MulticastAddressV6));
                }
//more code here

It works well on Android and in the editor but it doesn’t like iOS too much. It seems that it crashes with a EXC_BAD_ACCESS error.

I tried to track it down but I got stuck in the 2nd call to il2cpp::vm::Field::GetValueObject: which is called from il2cpp::icalls::System:System::Net::Sockets::Socket::SetSocketOption. It crashes when it tries to load a null reference (address 0x0).

Anyone else having trouble to use IPV6 with udp on iOS?

my advice is to file a bug report and meanwhile try to work around the call / use different approach to networking , if possible

I saw that they already had a problem with AddMembership to a multicast group and fixed it in 5.0.x and was wondering if that bug fix was reverted or something.

Which version of Unity are you using? All of the IPv6 functionality should be working properly now. So if this is a recent version of Unity, I would agree - please submit a bug report.

1 Like

Hello,

I am using 5.4.1f1 and I also submitted a bug report with the id: 900175

Thanks, we will investigate this issue.

I am also seeing this issue in 5.6.0f3 on iOS when building with IL2CPP.

@miralabs-evan

Thanks! We’re investigating the bug report submitted by @catalin-ene now. If you would like to submit another bug report, please do so. If the behavior you experience is the same, then we might have enough information in case 900175 to understand and correct the issue.