Bind loopback RUDP clients to loopback

This commit is contained in:
Meta Vens 2026-07-12 12:54:49 +01:00
commit b6c596866c

View file

@ -153,7 +153,9 @@ namespace GameCult.Networking
? parsed
: Dns.GetHostAddresses(host)[0];
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.Bind(new IPEndPoint(IPAddress.Any, 0));
socket.Bind(new IPEndPoint(
IPAddress.IsLoopback(remoteAddress) ? IPAddress.Loopback : IPAddress.Any,
0));
socket.ReceiveTimeout = 20;
_transport = new CultNetRudpSocketTransportConnection(new CultNetRudpSocketTransportOptions
{