Sample code for 30+ languages & platforms
Rust

DNS Lookup

Do a DNS lookup to resolve a hostname to an IP address.

Chilkat Rust Downloads

Rust
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let socket = chilkat::Socket::new();

let max_wait_ms = 10000;
let Ok(ip_addr) = socket.dns_lookup("www.chilkatsoft.com", max_wait_ms) else {
    println!("{}", socket.last_error_text());
    return;
};

println!("IP Address: {}", ip_addr);