Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Revert to Default DNS NameserversSee more DNS ExamplesDemonstrates how to revert back to the default nameservers of the local system where your application is running. Note: This example requires Chilkat v9.5.0.96 or later.
LOCAL loDns LOCAL lnNsCount LOCAL i LOCAL lnSupportsTls * The only reason you would have to revert back to the local system's default nameservers * is if your application had previously set different nameservers, and you wish to revert back. * When your application starts, the DNS nameservers to be used are the default nameservers * configured on the system where your application is running. * There is one exception: Chilkat defaults to using the public Google nameservers (8.8.8.8 and 8.8.4.4) for * Android applications. Reverting to the default nameservers would revert to the Google nameservers. * However, Chilkat does not query the local system for the default nameservers unless Chilkat needs * to do a DNS lookup and there not yet any DNS nameservers defined. Thus technically, when your application * starts, there are no default nameservers. They are auto-assigned when first needed. * If your application explicitly defines DNS nameservers, such as by calling AddDefaultnamervers, or AddNameserver * then Chilkat will not automatically auto-assign. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Dns') loDns = CreateObject('Chilkat.Dns') * Here we are explicitly adding the system default nameservers, because technically this application * has not yet done anything that would require a DNS lookup, and thus DNS nameservers are not yet defined. * Your default nameserver is assumed to not support TLS. loDns.AddDefaultNameservers() * Let's examine our nameservers lnNsCount = loDns.NumNameservers i = 0 DO WHILE i < lnNsCount ? STR(i + 1) + ": " + loDns.GetNameserver(i) i = i + 1 ENDDO * On my Windows system, the result is a single nameserver at * 1: 172.16.16.16 * --------------------------------------------------------- * We could add additional nameservers, such as Google and Cloudfare lnSupportsTls = 1 * Cloudfare loDns.AddNameserver("1.1.1.1",lnSupportsTls) * Google loDns.AddNameserver("8.8.8.8",lnSupportsTls) * See the nameservers now used by Chilkat lnNsCount = loDns.NumNameservers i = 0 DO WHILE i < lnNsCount ? STR(i + 1) + ": " + loDns.GetNameserver(i) i = i + 1 ENDDO * Result: * 1: 172.16.16.16 * 2: 1.1.1.1 * 3: 8.8.8.8 * --------------------------------------------------------- * To revert back to the system default nameservers, clear all * then re-add the default. loDns.RemoveAllNameservers() loDns.AddDefaultNameservers() * See the nameservers now used by Chilkat lnNsCount = loDns.NumNameservers i = 0 DO WHILE i < lnNsCount ? STR(i + 1) + ": " + loDns.GetNameserver(i) i = i + 1 ENDDO * Result: * 1: 172.16.16.16 RELEASE loDns |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.