RevenantX / LiteNetLib

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

Multiple Interface UDP Routing Problem #538

Closed mitsh closed 6 months ago

mitsh commented 6 months ago

I've been using Fishnet to develop games/apps in Unity. We've been facing an issue for awhile. If there is multiple interfaces on the server system, mostly our servers have more then two running interfaces, server send UDP Packages on wrong route. So, client doesn't get packages.

I've check the code base and solve the problem. If we set the socket option DontRoute to true, it'll work. I found at NetManager.Socket.cs file and added this line.

Could you please investigate and let me know. If you want I can make PR.

image

Server Interfaces WiFi: 192.168.0.68 LAN : 192.168.0.202

Client IP 192.168.0.59

Server listens 0.0.0.0. Client tries to connect 192.168.0.68, Server send packages via 192.168.0.202. I set DontRoute option, it solved the problem.

socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontRoute, true);

Library version: All version of Fishnet affected. I don't know exactly which version using in Fishnet.

Framework: Unity

OS: Linux Windows Macos

RevenantX commented 6 months ago

Fixed by #540