Sample code for 30+ languages & platforms
Lua

DNS Lookup

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

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local socket = chilkat.Socket.new()

local maxWaitMs = 10000
local ipAddr = socket:dns_lookup("www.chilkatsoft.com", maxWaitMs)
if not socket.last_method_success then
    print(socket.last_error_text)
    return
end

print("IP Address: " .. ipAddr)