React Native
React Native
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat React Native Downloads
import { Socket } from '@chilkat/react-native'
async function chilkatExample() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const socket = new Socket();
const maxWaitMs = 10000;
let ipAddr: string;
try {
ipAddr = await socket.dnsLookupAsync('www.chilkatsoft.com', maxWaitMs);
} catch {
console.log(socket.lastErrorText);
return;
}
console.log(`IP Address: ${ipAddr}`);
}