Resolve

Top  Previous  Next

transport.resolve allows you to resolve hostnames into IP addresses.

 

 

transport.resolve( hostname, callback )

 

The callback function will receive a table with ip addresses for the requested hostname or nil if there was an error resolving.

Example

 

transport.resolve("google.com", function ( ips )

 

 if not ips then

     print("No IP found")

     return

 end

 

 for i,ip in ipairs(ips) do

   print(ip)

 end

 

end)

 

This function printed

 

Thu May 2 14:28:11 2013        74.125.229.227

Thu May 2 14:28:11 2013        74.125.229.233

Thu May 2 14:28:11 2013        74.125.229.232

Thu May 2 14:28:11 2013        74.125.229.226

Thu May 2 14:28:11 2013        74.125.229.229

Thu May 2 14:28:11 2013        74.125.229.231

Thu May 2 14:28:11 2013        74.125.229.230

Thu May 2 14:28:11 2013        74.125.229.228

Thu May 2 14:28:11 2013        74.125.229.224

Thu May 2 14:28:11 2013        74.125.229.225

Thu May 2 14:28:11 2013        74.125.229.238