-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The check for ServiceIP == null or string.Empty fails on AWS Fargate (and perhaps other environments).
The if statement returns false and so ServiceIP isn't being set to a value.
https://github.com/pnxtech/Hydra4Net-Development/blob/master/Hydra4NET/Hydra.cs#L144
if (ServiceIP == null || ServiceIP == string.Empty)
{
using Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0);
socket.Connect("8.8.8.8", 65530);
if (socket.LocalEndPoint is IPEndPoint endPoint)
{
ServiceIP = endPoint.Address.ToString();
}
}I think we should replace the contents of the if (ServiceIP == null || ServiceIP == string.Empty) statement with:
var name = Dns.GetHostName();
ServiceIP = Dns.GetHostEntry(name).AddressList.FirstOrDefault(x => x.AddressFamily == AddressFamily.InterNetwork);Metadata
Metadata
Assignees
Labels
No labels