UDP communication via IPv6


i try to do some simple server-client communication via IPv6. My problem is that when i try to send a message i get an error that i’m using an ip which is not compatile with the protocol. Here is some relevant code:

IP = "2a02:810c:82c0:1c94:5d4e:81ab:1ed:edf3";
port = 9876;
remoteEndPoint = new IPEndPoint(IPAddress.Parse(IP), port);
client = new UdpClient();

and here is the send code:

byte[] data = Encoding.UTF8.GetBytes(text);
client.Send(data, data.Length, remoteEndPoint);

With IPv4 the code works. I also tried with MapToIPv4 method but it seems that unity doesn’t know this funktion. I need the input ip to be IPv6.

Thank you.

I think you should create your UdpClient as IPv6 client, Like so:

client = new UdpClient(AddressFamily.InterNetworkV6);

Besides that I don’t see any reason that IPv6 in combination with an UdpClient is not supported. May i ask what platform your build for? Also it might help to see the actual exception + stacktrace.