Blame doc/dns.html

Packit b53373
Packit b53373
    "http://www.w3.org/TR/html4/strict.dtd">
Packit b53373
<html>
Packit b53373
Packit b53373
<head>
Packit b53373
<meta name="description" content="LuaSocket: DNS support">
Packit b53373
<meta name="keywords" content="Lua, LuaSocket, DNS, Network, Library, Support">
Packit b53373
<title>LuaSocket: DNS support</title>
Packit b53373
<link rel="stylesheet" href="reference.css" type="text/css">
Packit b53373
</head>
Packit b53373
Packit b53373
<body>
Packit b53373
Packit b53373
Packit b53373
Packit b53373
Packit b53373

Packit b53373
<center>
Packit b53373
Packit b53373
Packit b53373
LuaSocket
Packit b53373
Packit b53373
Network support for the Lua language
Packit b53373
Packit b53373
Packit b53373

Packit b53373
home ·
Packit b53373
download ·
Packit b53373
installation ·
Packit b53373
introduction ·
Packit b53373
reference 
Packit b53373

Packit b53373
</center>
Packit b53373

Packit b53373
Packit b53373
Packit b53373
Packit b53373
Packit b53373

DNS

Packit b53373
Packit b53373

Packit b53373
IPv4 name resolution functions 
Packit b53373
<tt>dns.toip</tt>
Packit b53373
and
Packit b53373
<tt>dns.tohostname</tt>
Packit b53373
return all information obtained from 
Packit b53373
the resolver in a table of the form:
Packit b53373

Packit b53373
Packit b53373
<tt>
Packit b53373
resolved4 = {
Packit b53373
  name = canonic-name,
Packit b53373
  alias = alias-list,
Packit b53373
  ip = ip-address-list
Packit b53373
}
Packit b53373
</tt> 
Packit b53373
Packit b53373

Packit b53373
Note that the <tt>alias</tt> list can be empty.
Packit b53373

Packit b53373
Packit b53373

Packit b53373
The more general name resolution function 
Packit b53373
<tt>dns.getaddrinfo</tt>, which
Packit b53373
supports both IPv6 and IPv4,
Packit b53373
returns all information obtained from 
Packit b53373
the resolver in a table of the form:
Packit b53373

Packit b53373
Packit b53373
<tt>
Packit b53373
resolved6 = {
Packit b53373
  [1] = {
Packit b53373
    family = family-name-1,
Packit b53373
    addr = address-1
Packit b53373
  },
Packit b53373
  ...
Packit b53373
  [n] = {
Packit b53373
    family = family-name-n,
Packit b53373
    addr = address-n
Packit b53373
  }
Packit b53373
}
Packit b53373
</tt> 
Packit b53373
Packit b53373

Packit b53373
Here, <tt>family</tt> contains the string <tt>"inet"</tt> for IPv4
Packit b53373
addresses, and <tt>"inet6"</tt> for IPv6 addresses.
Packit b53373

Packit b53373
Packit b53373
Packit b53373
Packit b53373

Packit b53373
socket.dns.getaddrinfo(address)
Packit b53373

Packit b53373
Packit b53373

Packit b53373
Converts from host name to address. 
Packit b53373

Packit b53373
Packit b53373

Packit b53373
<tt>Address</tt> can  be an IPv4 or IPv6 address or host name. 
Packit b53373

Packit b53373
Packit b53373

Packit b53373
The function returns a table with  all  information returned  by
Packit b53373
the  resolver.  In  case of error, the function returns <tt>nil</tt>
Packit b53373
followed by an error message.  
Packit b53373

Packit b53373
Packit b53373
Packit b53373
Packit b53373

Packit b53373
socket.dns.gethostname()
Packit b53373

Packit b53373
Packit b53373

Packit b53373
Returns the standard host name for the machine as a string. 
Packit b53373

Packit b53373
Packit b53373
Packit b53373
Packit b53373

Packit b53373
socket.dns.tohostname(address)
Packit b53373

Packit b53373
Packit b53373

Packit b53373
Converts from IPv4 address to host name.
Packit b53373

Packit b53373
Packit b53373

Packit b53373
<tt>Address</tt> can  be an IP address  or host name. 
Packit b53373

Packit b53373
Packit b53373

Packit b53373
The function returns a string  with the canonic host name of the given
Packit b53373
<tt>address</tt>, followed  by a  table with  all  information returned  by
Packit b53373
the  resolver.  In  case of error, the function returns <tt>nil</tt>
Packit b53373
followed by an error message.  
Packit b53373

Packit b53373
Packit b53373
Packit b53373
Packit b53373

Packit b53373
socket.dns.toip(address)
Packit b53373

Packit b53373
Packit b53373

Packit b53373
Converts from host name to IPv4 address.
Packit b53373

Packit b53373
Packit b53373

Packit b53373
<tt>Address</tt> can  be an IP address  or host name. 
Packit b53373

Packit b53373
Packit b53373

Packit b53373
Returns a string  with the first IP address  found for <tt>address</tt>,
Packit b53373
followed  by a  table with  all  information returned  by the  resolver.
Packit b53373
In  case of error, the function returns <tt>nil</tt> followed by an error
Packit b53373
message. 
Packit b53373

Packit b53373
Packit b53373
Packit b53373
Packit b53373
Packit b53373

Packit b53373
<center>
Packit b53373

Packit b53373
home ·
Packit b53373
download ·
Packit b53373
installation ·
Packit b53373
introduction ·
Packit b53373
reference
Packit b53373

Packit b53373

Packit b53373
<small>
Packit b53373
Last modified by Diego Nehab on 
Packit b53373
Thu Apr 20 00:25:07 EDT 2006
Packit b53373
</small>
Packit b53373

Packit b53373
</center>
Packit b53373
Packit b53373
Packit b53373
</body>
Packit b53373
</html>