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

try-catch added when trying to get MAC address

This commit is contained in:
lidgren
2010-12-24 08:04:23 +00:00
parent 3aa9fc0836
commit cb887dd4b5

View File

@@ -94,6 +94,8 @@ namespace Lidgren.Network
NetRandom.Instance.NextBytes(macBytes);
#if IS_MAC_AVAILABLE
try
{
System.Net.NetworkInformation.PhysicalAddress pa = NetUtility.GetMacAddress();
if (pa != null)
{
@@ -104,6 +106,11 @@ namespace Lidgren.Network
{
LogWarning("Failed to get Mac address");
}
}
catch (NotSupportedException)
{
// not supported; lets just kee the random bytes set above
}
#endif
byte[] epBytes = BitConverter.GetBytes(boundEp.GetHashCode());
byte[] combined = new byte[epBytes.Length + macBytes.Length];