diff --git a/AssettoServer/Network/Udp/ACUdpServer.cs b/AssettoServer/Network/Udp/ACUdpServer.cs index b8de9556..8acc3968 100644 --- a/AssettoServer/Network/Udp/ACUdpServer.cs +++ b/AssettoServer/Network/Udp/ACUdpServer.cs @@ -72,7 +72,11 @@ private void ReceiveLoop(CancellationToken stoppingToken) var bytesRead = _socket.ReceiveFrom(buffer, SocketFlags.None, address); OnReceived(address, buffer, bytesRead); } - catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) { } + catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) + { + // This is a workaround because on Linux, the SocketAddress Size will be set to 0 for some reason + address.Size = address.Buffer.Length; + } catch (Exception ex) { Log.Error(ex, "Error in UDP receive loop"); diff --git a/AssettoServer/Network/Udp/UdpPluginServer.cs b/AssettoServer/Network/Udp/UdpPluginServer.cs index 06a056fb..a1d37bc1 100644 --- a/AssettoServer/Network/Udp/UdpPluginServer.cs +++ b/AssettoServer/Network/Udp/UdpPluginServer.cs @@ -152,7 +152,11 @@ private void ReceiveLoop(CancellationToken stoppingToken) Log.Information("Ignoring UDP Plugin packet from address {Address}", address); } } - catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) { } + catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) + { + // This is a workaround because on Linux, the SocketAddress Size will be set to 0 for some reason + address.Size = address.Buffer.Length; + } catch (Exception ex) { Log.Error(ex, "Error in UDP plugin receive loop");