1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-15 22:56:30 +09:00

Fixed null ref exception. Fixed problem with wrong ip address.

This commit is contained in:
Badartefact
2019-06-14 12:13:14 +03:00
parent d577f874a9
commit 37cd6ac2c3
2 changed files with 8 additions and 3 deletions

View File

@@ -154,8 +154,13 @@ namespace Lidgren.Network
m_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
}
else if(m_configuration.DualStack && m_configuration.LocalAddress.AddressFamily == AddressFamily.InterNetworkV6)
NetUtility.CopyEndpoint(target, targetCopy); //Maps to IPv6 for Dual Mode
NetUtility.CopyEndpoint(target, targetCopy); //Maps to IPv6 for Dual Mode
else
{
targetCopy.Port = target.Port;
targetCopy.Address = target.Address;
}
int bytesSent = m_socket.SendTo(data, 0, numBytes, SocketFlags.None, targetCopy);
if (numBytes != bytesSent)
LogWarning("Failed to send the full " + numBytes + "; only " + bytesSent + " bytes sent in packet!");

View File

@@ -189,7 +189,7 @@ namespace Lidgren.Network
return null;
foreach (var address in addresses)
{
if (address.AddressFamily == AddressFamily.InterNetwork || ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
if (address.AddressFamily == AddressFamily.InterNetwork || address.AddressFamily == AddressFamily.InterNetworkV6)
return address;
}
return null;