Unverified Commit 3c4629b5 authored by Lemon's avatar Lemon Committed by GitHub

fix Device not configured (#47)

parent 035c6b2a
...@@ -17,8 +17,11 @@ ...@@ -17,8 +17,11 @@
*/ */
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using SkyWalking.Boot; using SkyWalking.Boot;
...@@ -122,10 +125,7 @@ namespace SkyWalking.Remote ...@@ -122,10 +125,7 @@ namespace SkyWalking.Remote
ProcessNo = Process.GetCurrentProcess().Id ProcessNo = Process.GetCurrentProcess().Id
}; };
// todo fix Device not configured osInfo.Ipv4S.AddRange(GetIpV4S(hostName));
//var ipv4s = Dns.GetHostAddresses(hostName);
//foreach (var ipAddress in ipv4s.Where(x => x.AddressFamily == AddressFamily.InterNetwork))
// osInfo.Ipv4S.Add(ipAddress.ToString());
var applicationInstance = new ApplicationInstance var applicationInstance = new ApplicationInstance
{ {
...@@ -161,5 +161,23 @@ namespace SkyWalking.Remote ...@@ -161,5 +161,23 @@ namespace SkyWalking.Remote
} }
} }
} }
private IEnumerable<string> GetIpV4S(string hostName)
{
try
{
var ipAddresses = Dns.GetHostAddresses(hostName);
var ipV4S = new List<string>();
foreach (var ipAddress in ipAddresses.Where(x => x.AddressFamily == AddressFamily.InterNetwork))
ipV4S.Add(ipAddress.ToString());
return ipV4S;
}
catch (Exception e)
{
_logger.Warning($"Get host addresses fail. {e.Message}");
return new string[0];
}
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment