2022-03-22 19:21:58 +01:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2003-08-31 03:00:15 +02:00
|
|
|
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
2004-06-21 08:07:58 +02:00
|
|
|
<meta name="description" content="LuaSocket: DNS support">
|
2004-11-28 09:17:16 +01:00
|
|
|
<meta name="keywords" content="Lua, LuaSocket, DNS, Network, Library, Support">
|
2004-06-21 08:07:58 +02:00
|
|
|
<title>LuaSocket: DNS support</title>
|
2003-08-31 03:00:15 +02:00
|
|
|
<link rel="stylesheet" href="reference.css" type="text/css">
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<!-- header +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<div class="header">
|
2003-08-31 03:00:15 +02:00
|
|
|
<hr>
|
|
|
|
<center>
|
|
|
|
<table summary="LuaSocket logo">
|
2022-03-22 19:21:58 +01:00
|
|
|
<tr><td align="center"><a href="http://www.lua.org">
|
|
|
|
<img width="128" height="128" border="0" alt="LuaSocket" src="luasocket.png">
|
2003-08-31 03:00:15 +02:00
|
|
|
</a></td></tr>
|
2022-03-22 19:21:58 +01:00
|
|
|
<tr><td align="center" valign="top">Network support for the Lua language
|
2003-08-31 03:00:15 +02:00
|
|
|
</td></tr>
|
|
|
|
</table>
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="bar">
|
2009-05-27 11:31:38 +02:00
|
|
|
<a href="index.html">home</a> ·
|
|
|
|
<a href="index.html#download">download</a> ·
|
2004-12-13 07:26:01 +01:00
|
|
|
<a href="installation.html">installation</a> ·
|
2003-08-31 03:00:15 +02:00
|
|
|
<a href="introduction.html">introduction</a> ·
|
2022-03-22 19:21:58 +01:00
|
|
|
<a href="reference.html">reference</a>
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
</center>
|
|
|
|
<hr>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- dns ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<h2 id="dns">DNS</h2>
|
2003-08-31 03:00:15 +02:00
|
|
|
|
|
|
|
<p>
|
2022-03-22 19:21:58 +01:00
|
|
|
IPv4 name resolution functions
|
|
|
|
<a href="#toip"><tt>dns.toip</tt></a>
|
2012-04-16 19:15:26 +02:00
|
|
|
and
|
2022-03-22 19:21:58 +01:00
|
|
|
<a href="#tohostname"><tt>dns.tohostname</tt></a>
|
|
|
|
return <em>all</em> information obtained from
|
2012-04-16 19:15:26 +02:00
|
|
|
the resolver in a table of the form:
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<blockquote><tt>
|
2012-04-16 19:15:26 +02:00
|
|
|
resolved4 = {<br>
|
2003-08-31 03:00:15 +02:00
|
|
|
name = <i>canonic-name</i>,<br>
|
|
|
|
alias = <i>alias-list</i>,<br>
|
|
|
|
ip = <i>ip-address-list</i><br>
|
|
|
|
}
|
|
|
|
</tt> </blockquote>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Note that the <tt>alias</tt> list can be empty.
|
|
|
|
</p>
|
|
|
|
|
2012-04-16 19:15:26 +02:00
|
|
|
<p>
|
2022-03-22 19:21:58 +01:00
|
|
|
The more general name resolution function
|
|
|
|
<a href="#getaddrinfo"><tt>dns.getaddrinfo</tt></a>, which
|
2012-04-16 19:15:26 +02:00
|
|
|
supports both IPv6 and IPv4,
|
2022-03-22 19:21:58 +01:00
|
|
|
returns <em>all</em> information obtained from
|
2012-04-16 19:15:26 +02:00
|
|
|
the resolver in a table of the form:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<blockquote><tt>
|
|
|
|
resolved6 = {<br>
|
|
|
|
[1] = {<br>
|
|
|
|
family = <i>family-name-1</i>,<br>
|
|
|
|
addr = <i>address-1</i><br>
|
|
|
|
},<br>
|
|
|
|
...<br>
|
|
|
|
[n] = {<br>
|
|
|
|
family = <i>family-name-n</i>,<br>
|
|
|
|
addr = <i>address-n</i><br>
|
|
|
|
}<br>
|
|
|
|
}
|
|
|
|
</tt> </blockquote>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Here, <tt>family</tt> contains the string <tt>"inet"</tt> for IPv4
|
|
|
|
addresses, and <tt>"inet6"</tt> for IPv6 addresses.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<!-- getaddrinfo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="name" id="getaddrinfo">
|
2012-04-16 19:15:26 +02:00
|
|
|
socket.dns.<b>getaddrinfo(</b>address<b>)</b>
|
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="description">
|
|
|
|
Converts from host name to address.
|
2012-04-16 19:15:26 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="parameters">
|
|
|
|
<tt>Address</tt> can be an IPv4 or IPv6 address or host name.
|
2012-04-16 19:15:26 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="return">
|
2012-04-16 19:15:26 +02:00
|
|
|
The function returns a table with all information returned by
|
|
|
|
the resolver. In case of error, the function returns <b><tt>nil</tt></b>
|
2022-03-22 19:21:58 +01:00
|
|
|
followed by an error message.
|
2012-04-16 19:15:26 +02:00
|
|
|
</p>
|
|
|
|
|
2004-02-04 15:29:11 +01:00
|
|
|
<!-- gethostname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="name" id="gethostname">
|
2004-02-04 15:29:11 +01:00
|
|
|
socket.dns.<b>gethostname()</b>
|
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="description">
|
|
|
|
Returns the standard host name for the machine as a string.
|
2004-02-04 15:29:11 +01:00
|
|
|
</p>
|
|
|
|
|
2003-08-31 03:00:15 +02:00
|
|
|
<!-- tohostname +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="name" id="tohostname">
|
2004-06-16 01:00:56 +02:00
|
|
|
socket.dns.<b>tohostname(</b>address<b>)</b>
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="description">
|
2012-04-16 19:15:26 +02:00
|
|
|
Converts from IPv4 address to host name.
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="parameters">
|
|
|
|
<tt>Address</tt> can be an IP address or host name.
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="return">
|
2004-05-25 08:51:43 +02:00
|
|
|
The function returns a string with the canonic host name of the given
|
2003-08-31 03:00:15 +02:00
|
|
|
<tt>address</tt>, followed by a table with all information returned by
|
2004-01-24 03:47:24 +01:00
|
|
|
the resolver. In case of error, the function returns <b><tt>nil</tt></b>
|
2022-03-22 19:21:58 +01:00
|
|
|
followed by an error message.
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<!-- toip +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="name" id="toip">
|
2004-06-16 01:00:56 +02:00
|
|
|
socket.dns.<b>toip(</b>address<b>)</b>
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="description">
|
2012-04-16 19:15:26 +02:00
|
|
|
Converts from host name to IPv4 address.
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="parameters">
|
|
|
|
<tt>Address</tt> can be an IP address or host name.
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="return">
|
2003-08-31 03:00:15 +02:00
|
|
|
Returns a string with the first IP address found for <tt>address</tt>,
|
|
|
|
followed by a table with all information returned by the resolver.
|
2004-01-24 03:47:24 +01:00
|
|
|
In case of error, the function returns <b><tt>nil</tt></b> followed by an error
|
2022-03-22 19:21:58 +01:00
|
|
|
message.
|
2003-08-31 03:00:15 +02:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
|
|
2022-03-22 19:21:58 +01:00
|
|
|
<div class="footer">
|
2003-08-31 03:00:15 +02:00
|
|
|
<hr>
|
|
|
|
<center>
|
2022-03-22 19:21:58 +01:00
|
|
|
<p class="bar">
|
2009-05-27 11:31:38 +02:00
|
|
|
<a href="index.html">home</a> ·
|
|
|
|
<a href="index.html#down">download</a> ·
|
2004-12-13 07:26:01 +01:00
|
|
|
<a href="installation.html">installation</a> ·
|
2003-08-31 03:00:15 +02:00
|
|
|
<a href="introduction.html">introduction</a> ·
|
|
|
|
<a href="reference.html">reference</a>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<small>
|
|
|
|
Last modified by Diego Nehab on <br>
|
2006-04-20 06:27:13 +02:00
|
|
|
Thu Apr 20 00:25:07 EDT 2006
|
2003-08-31 03:00:15 +02:00
|
|
|
</small>
|
|
|
|
</p>
|
|
|
|
</center>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|