in toolkit/Toolkit/SqlManagedInstanceToolkit.cs [35:72]
private static List<string> CheckIp(string ipAddress, int port = 443)
{
List<string> result = new List<string>();
// Check tcp connection to port
//
if (ipAddress != null)
{
try
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(ipAddress, port);
if (socket.Connected)
{
result.Add(string.Format("TCP connect to {0}:{1} was successful.", ipAddress, port));
}
}
catch (SocketException se)
{
if (se.ErrorCode == 10061)
{
result.Add(string.Format("TCP connect to {0}:{1} failed because there were no listener. However the port is open.", ipAddress, port));
}
else
{
result.Add(string.Format("TCP connect to {0}:{1} failed with {2}.", ipAddress, port, se.Message));
}
}
catch (Exception ex)
{
result.Add(string.Format("TCP connect to {0}:{1} failed with {2}.", ipAddress, port, ex.Message));
}
}
return result;
}