/// <summary> /// Build a DNS name for the geographically closest AWS service. /// </summary> /// <returns>The DNS name of the closest AWS service.</returns> private string GetBestEndpoint() { string domain = NetworkStatus.GetBestDomainName(); if (!String.IsNullOrEmpty(domain)) { if (domain.EndsWith(".com")) { return(URLPrefix + ".com"); } if (domain.EndsWith(".ca")) { return(URLPrefix + ".ca"); } if (domain.EndsWith(".co.uk")) { return(URLPrefix + ".co.uk"); } if (domain.EndsWith(".de")) { return(URLPrefix + ".de"); } if (domain.EndsWith(".fr")) { return(URLPrefix + ".fr"); } if (domain.EndsWith(".jp")) { return(URLPrefix + ".jp"); } } return(URLPrefix + ".com"); }
private void DumpNetworkStats() { Console.WriteLine(); Console.WriteLine("Domain name is [{0}]", NetworkStatus.GetBestDomainName()); bool isAvailable = NetworkInterface.GetIsNetworkAvailable(); Console.WriteLine(String.Format("isAvailable = [{0}]", isAvailable ? "Yes" : "No")); NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface face in interfaces) { Console.WriteLine(String.Format( "Interface [{0}] ({1}), type=[{2}]", face.Name, face.Description, face.NetworkInterfaceType.ToString())); IPv4InterfaceStatistics stats = face.GetIPv4Statistics(); Console.WriteLine(String.Format( " Status......: [{0}] Rcv/Snd=[{1}/{2}]", face.OperationalStatus.ToString(), stats.BytesReceived, stats.BytesSent)); } }