diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2012-04-17 01:15:26 +0800 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2012-04-17 01:15:26 +0800 |
commit | f37e0260261f7691246429d227cf7124c291e8b1 (patch) | |
tree | 7e84322c8852d4227e36958af1132a4588f64795 /doc/dns.html | |
parent | b3c4f46179ed5b27ca76a824f8730fa50dbaae0b (diff) | |
download | luasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.gz luasocket-f37e0260261f7691246429d227cf7124c291e8b1.tar.bz2 luasocket-f37e0260261f7691246429d227cf7124c291e8b1.zip |
First stab at documenation
Update Lua and Luasocket version in samples and in documentation
Documented ipv5_v6only default option being set
Documented tcp6 and udp6
Documented dns.getaddrinfo
Documented zero-sized datagram change?
Documented getoption
Diffstat (limited to 'doc/dns.html')
-rw-r--r-- | doc/dns.html | 61 |
1 files changed, 56 insertions, 5 deletions
diff --git a/doc/dns.html b/doc/dns.html index a38e368..c4a0472 100644 --- a/doc/dns.html +++ b/doc/dns.html | |||
@@ -39,12 +39,16 @@ | |||
39 | <h2 id=dns>DNS</h2> | 39 | <h2 id=dns>DNS</h2> |
40 | 40 | ||
41 | <p> | 41 | <p> |
42 | Name resolution functions return <em>all</em> information obtained from the | 42 | IPv4 name resolution functions |
43 | resolver in a table of the form: | 43 | <a href=#toip><tt>dns.toip</tt></a> |
44 | and | ||
45 | <a href=#tohostname><tt>dns.tohostname</tt></a> | ||
46 | return <em>all</em> information obtained from | ||
47 | the resolver in a table of the form: | ||
44 | </p> | 48 | </p> |
45 | 49 | ||
46 | <blockquote><tt> | 50 | <blockquote><tt> |
47 | resolved = {<br> | 51 | resolved4 = {<br> |
48 | name = <i>canonic-name</i>,<br> | 52 | name = <i>canonic-name</i>,<br> |
49 | alias = <i>alias-list</i>,<br> | 53 | alias = <i>alias-list</i>,<br> |
50 | ip = <i>ip-address-list</i><br> | 54 | ip = <i>ip-address-list</i><br> |
@@ -55,6 +59,53 @@ resolved = {<br> | |||
55 | Note that the <tt>alias</tt> list can be empty. | 59 | Note that the <tt>alias</tt> list can be empty. |
56 | </p> | 60 | </p> |
57 | 61 | ||
62 | <p> | ||
63 | The more general name resolution function | ||
64 | <a href=#getaddrinfo><tt>dns.getaddrinfo</tt></a>, which | ||
65 | supports both IPv6 and IPv4, | ||
66 | returns <em>all</em> information obtained from | ||
67 | the resolver in a table of the form: | ||
68 | </p> | ||
69 | |||
70 | <blockquote><tt> | ||
71 | resolved6 = {<br> | ||
72 | [1] = {<br> | ||
73 | family = <i>family-name-1</i>,<br> | ||
74 | addr = <i>address-1</i><br> | ||
75 | },<br> | ||
76 | ...<br> | ||
77 | [n] = {<br> | ||
78 | family = <i>family-name-n</i>,<br> | ||
79 | addr = <i>address-n</i><br> | ||
80 | }<br> | ||
81 | } | ||
82 | </tt> </blockquote> | ||
83 | |||
84 | <p> | ||
85 | Here, <tt>family</tt> contains the string <tt>"inet"</tt> for IPv4 | ||
86 | addresses, and <tt>"inet6"</tt> for IPv6 addresses. | ||
87 | </p> | ||
88 | |||
89 | <!-- getaddrinfo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
90 | |||
91 | <p class=name id=getaddrinfo> | ||
92 | socket.dns.<b>getaddrinfo(</b>address<b>)</b> | ||
93 | </p> | ||
94 | |||
95 | <p class=description> | ||
96 | Converts from host name to address. | ||
97 | </p> | ||
98 | |||
99 | <p class=parameters> | ||
100 | <tt>Address</tt> can be an IPv4 or IPv6 address or host name. | ||
101 | </p> | ||
102 | |||
103 | <p class=return> | ||
104 | The function returns a table with all information returned by | ||
105 | the resolver. In case of error, the function returns <b><tt>nil</tt></b> | ||
106 | followed by an error message. | ||
107 | </p> | ||
108 | |||
58 | <!-- gethostname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 109 | <!-- gethostname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
59 | 110 | ||
60 | <p class=name id=gethostname> | 111 | <p class=name id=gethostname> |
@@ -72,7 +123,7 @@ socket.dns.<b>tohostname(</b>address<b>)</b> | |||
72 | </p> | 123 | </p> |
73 | 124 | ||
74 | <p class=description> | 125 | <p class=description> |
75 | Converts from IP address to host name. | 126 | Converts from IPv4 address to host name. |
76 | </p> | 127 | </p> |
77 | 128 | ||
78 | <p class=parameters> | 129 | <p class=parameters> |
@@ -93,7 +144,7 @@ socket.dns.<b>toip(</b>address<b>)</b> | |||
93 | </p> | 144 | </p> |
94 | 145 | ||
95 | <p class=description> | 146 | <p class=description> |
96 | Converts from host name to IP address. | 147 | Converts from host name to IPv4 address. |
97 | </p> | 148 | </p> |
98 | 149 | ||
99 | <p class=parameters> | 150 | <p class=parameters> |