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
(Unicode C++) Use Public DNS Servers (Google and Cloudfare)See more DNS ExamplesDemonstrates how to use Google and Cloudfare nameservers for all DNS lookups within Chilkat. Note: This example requires Chilkat v9.5.0.96 or later.
#include <CkDnsW.h> void ChilkatSample(void) { // The new Chilkat DNS class is a singleton that allows an applicaton to select // the DNS nameservers used throughout Chilkat. // "singleton" means that all Chilkat DNS object instances work with a single // copy of internal DNS settings that are application wide. // Chilkat does DNS lookups internally whenever a domain name is passed to a Chilkat method, or when the domain // name is part of a URL passed to a Chilkat method. It could be in HTTP, Ftp2, SSH, IMAP, Socket, etc. // This exampel will show how to use the Cloudfare and Google DNS servers. // // Google Public DNS: // - Primary DNS: 8.8.8.8 // - Secondary DNS: 8.8.4.4 // Google Public DNS is known for its speed and reliability. It's operated by Google and is widely used by many internet users. // Cloudfare Public DNS: // - Primary DNS: 1.1.1.1 // - Secondary DNS: 1.0.0.1 // Cloudfare Public DNS is also known for its speed and reliability, and is also widely used. CkDnsW dns; // Indicate our TLS preference: // 0: No TLS // 1: Prefer TLS if possible // 2: Require TLS dns.put_TlsPref(0); // If you choose "No TLS", then all DNS requests will use UDP, or TCP for those requests with large responses. // Choosing "No TLS" provides the fastest DNS lookups, and is generally what you're already doing. // If you choose "Prefer TLS if possible", then Chilkat will use DNS over TLS for those nameservers that // support TLS. // If you choose "Require TLS", then Chilkat will ignore nameservers that don't support TLS, // and all DNS communications will occur over private and secure TLS connections. // When you specify a nameserver to be used, you'll tell Chilkat whether it supports DNS or not. // Here' we're setting the nameservers to Google and Cloudfare. // They both support TLS, but since we set our TLS preference = 0, Chilkat will not use TLS. // (If we set our TLS preference equal to 1 or 2, then Chilkat will use TLS for Google and Cloudfare DNS.) // First, make sure we remove all existing nameservers. dns.RemoveAllNameservers(); // Add the Google and Cloudfare nameservers. bool supportsTls = true; dns.AddNameserver(L"1.1.1.1",supportsTls); dns.AddNameserver(L"8.8.8.8",supportsTls); dns.AddNameserver(L"1.0.0.1",supportsTls); dns.AddNameserver(L"8.8.4.4",supportsTls); // That's it. Now all DNS lookups in Chilkat will use the above nameservers. } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.