RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3.06k stars 495 forks source link

Message sended/received twice with IPv6Enabled #533

Closed michael-balle closed 12 months ago

michael-balle commented 12 months ago

Hi, I have IPv6Enabled and when I send a message from the client to server (two Unity applications on the same machine) I get them twice on the server – one via IPv4 and the same via IPv6.

Thought the NetManager checks if IPv6 works and then only sends the message once via IPv6 (if not sends it automatically via IPv4 only).

How can I fix this (except by disabling IPv6)?

RevenantX commented 12 months ago

@michael-balle hi. Can you send minimal example project with reproduce?

michael-balle commented 12 months ago

SvNetworkManagerClient.txt SvNetworkManagerServer.txt SvNetworkMessageTypes.txt

RevenantX commented 12 months ago

@michael-balle seems that it's because you broadcasting and received both ipv4 and ipv6 address. image Check ConnectedPeersCount will not save here, because connecting taking some time. You can use GetPeersCount(ConnectionState.Any)

michael-balle commented 12 months ago

Great, thank you.