in sdk/src/Core/Internal/Utils/IPEndPointExtension.cs [64:101]
public static bool TryParse(string input, out IPEndPoint endPoint)
{
endPoint = null;
string[] ep = input.Split(':');
if (ep.Length != 2)
{
_logger.InfoFormat("Failed to parse IPEndpoint because input has not exactly two parts splitting by ':'. ({0})", input);
return false;
}
// Validate IP address is in valid range
IPAddress ip;
if (!IPAddress.TryParse(ep[0], out ip))
{
_logger.InfoFormat("Failed to parse IPEndPoint because ip address is invalid. ({0})", input);
return false;
}
int port;
if (!int.TryParse(ep[1], NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out port))
{
_logger.InfoFormat("Failed to parse IPEndPoint because port is invalid. ({0})", input);
return false;
}
try
{
// Validate port number is in valid range
endPoint = new IPEndPoint(ip, port);
return true;
}
catch (ArgumentOutOfRangeException e)
{
_logger.Error(e, "Failed to parse IPEndPoint because argument to IPEndPoint is invalid. ({0}", input);
return false;
}
}