in toolkit/Toolkit/SqlManagedInstanceToolkit.cs [80:135]
private static List<string> CheckFqdn(string fqdn, out string ipAddress)
{
ipAddress = null;
List<string> result = new List<string>();
// Resolve fqdn
//
try
{
int cnt = 0;
string addresses = string.Empty;
IPHostEntry destination = Dns.GetHostEntry(fqdn);
foreach (var addr in destination.AddressList)
{
addresses += addr + ";";
if (cnt++ == 0)
{
ipAddress = addr.ToString();
}
}
result.Add(string.Format("Hostname {0} was successfully resolved to: {1}.", fqdn, addresses));
}
catch (SocketException se)
{
if (se.ErrorCode == 11001)
{
result.Add(string.Format("Hostname {0} could not be found", fqdn));
}
else
{
result.Add(string.Format("DNS resolution of {0} thrown following error {1}.", fqdn, se.ErrorCode));
}
}
catch (Exception ex)
{
result.Add(string.Format("DNS resolution of {0} thrown following exc {1}.", fqdn, ex.Message));
}
// Check TCP ping
//
Ping ping = new Ping();
try
{
PingReply reply = ping.Send(fqdn);
result.Add(string.Format("PING to {0} reported status {1}.", fqdn, reply.Status));
}
catch (Exception ex)
{
result.Add(string.Format("PING to {0} thrown following exc {1}.", fqdn, ex.Message));
}
return result;
}