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/tcp.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/tcp.html')
-rw-r--r-- | doc/tcp.html | 85 |
1 files changed, 59 insertions, 26 deletions
diff --git a/doc/tcp.html b/doc/tcp.html index f59d7ac..dc1a0b6 100644 --- a/doc/tcp.html +++ b/doc/tcp.html | |||
@@ -36,16 +36,16 @@ | |||
36 | 36 | ||
37 | <!-- tcp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 37 | <!-- tcp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
38 | 38 | ||
39 | <h2 id=tcp>TCP</h2> | 39 | <h2 id="tcp">TCP</h2> |
40 | 40 | ||
41 | <!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 41 | <!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
42 | 42 | ||
43 | <p class=name id=socket.tcp> | 43 | <p class=name id="socket.tcp"> |
44 | socket.<b>tcp()</b> | 44 | socket.<b>tcp()</b> |
45 | </p> | 45 | </p> |
46 | 46 | ||
47 | <p class=description> | 47 | <p class=description> |
48 | Creates and returns a TCP master object. A master object can | 48 | Creates and returns an IPv4 TCP master object. A master object can |
49 | be transformed into a server object with the method | 49 | be transformed into a server object with the method |
50 | <a href=#listen><tt>listen</tt></a> (after a call to <a | 50 | <a href=#listen><tt>listen</tt></a> (after a call to <a |
51 | href=#bind><tt>bind</tt></a>) or into a client object with | 51 | href=#bind><tt>bind</tt></a>) or into a client object with |
@@ -58,9 +58,34 @@ In case of success, a new master object is returned. In case of error, | |||
58 | <b><tt>nil</tt></b> is returned, followed by an error message. | 58 | <b><tt>nil</tt></b> is returned, followed by an error message. |
59 | </p> | 59 | </p> |
60 | 60 | ||
61 | <!-- socket.tcp6 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
62 | |||
63 | <p class=name id="socket.tcp6"> | ||
64 | socket.<b>tcp6()</b> | ||
65 | </p> | ||
66 | |||
67 | <p class=description> | ||
68 | Creates and returns an IPv6 TCP master object. A master object can | ||
69 | be transformed into a server object with the method | ||
70 | <a href=#listen><tt>listen</tt></a> (after a call to <a | ||
71 | href=#bind><tt>bind</tt></a>) or into a client object with | ||
72 | the method <a href=#connect><tt>connect</tt></a>. The only other | ||
73 | method supported by a master object is the | ||
74 | <a href=#close><tt>close</tt></a> method.</p> | ||
75 | |||
76 | <p class=return> | ||
77 | In case of success, a new master object is returned. In case of error, | ||
78 | <b><tt>nil</tt></b> is returned, followed by an error message. | ||
79 | </p> | ||
80 | |||
81 | <p class=note> | ||
82 | Note: The TCP object returned will have the option | ||
83 | "<tt>ipv6-v6only</tt>" set to <tt><b>true</b></tt>. | ||
84 | </p> | ||
85 | |||
61 | <!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 86 | <!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
62 | 87 | ||
63 | <p class=name id=accept> | 88 | <p class=name id="accept"> |
64 | server:<b>accept()</b> | 89 | server:<b>accept()</b> |
65 | </p> | 90 | </p> |
66 | 91 | ||
@@ -87,7 +112,7 @@ might block until <em>another</em> client shows up. | |||
87 | 112 | ||
88 | <!-- bind +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 113 | <!-- bind +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
89 | 114 | ||
90 | <p class=name id=bind> | 115 | <p class=name id="bind"> |
91 | master:<b>bind(</b>address, port<b>)</b> | 116 | master:<b>bind(</b>address, port<b>)</b> |
92 | </p> | 117 | </p> |
93 | 118 | ||
@@ -116,7 +141,7 @@ is available and is a shortcut for the creation of server sockets. | |||
116 | 141 | ||
117 | <!-- close ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 142 | <!-- close ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
118 | 143 | ||
119 | <p class=name id=close> | 144 | <p class=name id="close"> |
120 | master:<b>close()</b><br> | 145 | master:<b>close()</b><br> |
121 | client:<b>close()</b><br> | 146 | client:<b>close()</b><br> |
122 | server:<b>close()</b> | 147 | server:<b>close()</b> |
@@ -139,7 +164,7 @@ automatically closed before destruction, though. | |||
139 | 164 | ||
140 | <!-- connect ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 165 | <!-- connect ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
141 | 166 | ||
142 | <p class=name id=connect> | 167 | <p class=name id="connect"> |
143 | master:<b>connect(</b>address, port<b>)</b> | 168 | master:<b>connect(</b>address, port<b>)</b> |
144 | </p> | 169 | </p> |
145 | 170 | ||
@@ -180,9 +205,18 @@ href=socket.html#select><tt>socket.select</tt></a> with the socket in the | |||
180 | established. | 205 | established. |
181 | </p> | 206 | </p> |
182 | 207 | ||
208 | <p class=note> | ||
209 | Note: Starting with LuaSocket 2.1, the host name resolution | ||
210 | depends on whether the socket was created by <a | ||
211 | href=#socket.tcp><tt>socket.tcp</tt></a> or <a | ||
212 | href=#socket.tcp6><tt>socket.tcp6</tt></a>. Addresses from | ||
213 | the appropriate family are tried in succession until the | ||
214 | first success or until the last failure. | ||
215 | </p> | ||
216 | |||
183 | <!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 217 | <!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
184 | 218 | ||
185 | <p class=name id=getpeername> | 219 | <p class=name id="getpeername"> |
186 | client:<b>getpeername()</b> | 220 | client:<b>getpeername()</b> |
187 | </p> | 221 | </p> |
188 | 222 | ||
@@ -202,7 +236,7 @@ Note: It makes no sense to call this method on server objects. | |||
202 | 236 | ||
203 | <!-- getsockname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 237 | <!-- getsockname ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
204 | 238 | ||
205 | <p class=name id=getsockname> | 239 | <p class=name id="getsockname"> |
206 | master:<b>getsockname()</b><br> | 240 | master:<b>getsockname()</b><br> |
207 | client:<b>getsockname()</b><br> | 241 | client:<b>getsockname()</b><br> |
208 | server:<b>getsockname()</b> | 242 | server:<b>getsockname()</b> |
@@ -219,7 +253,7 @@ the port. In case of error, the method returns <b><tt>nil</tt></b>. | |||
219 | 253 | ||
220 | <!-- getstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 254 | <!-- getstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
221 | 255 | ||
222 | <p class=name id=getstats> | 256 | <p class=name id="getstats"> |
223 | master:<b>getstats()</b><br> | 257 | master:<b>getstats()</b><br> |
224 | client:<b>getstats()</b><br> | 258 | client:<b>getstats()</b><br> |
225 | server:<b>getstats()</b><br> | 259 | server:<b>getstats()</b><br> |
@@ -237,7 +271,7 @@ and the age of the socket object in seconds. | |||
237 | 271 | ||
238 | <!-- listen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 272 | <!-- listen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
239 | 273 | ||
240 | <p class=name id=listen> | 274 | <p class=name id="listen"> |
241 | master:<b>listen(</b>backlog<b>)</b> | 275 | master:<b>listen(</b>backlog<b>)</b> |
242 | </p> | 276 | </p> |
243 | 277 | ||
@@ -265,7 +299,7 @@ method returns <b><tt>nil</tt></b> followed by an error message. | |||
265 | 299 | ||
266 | <!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 300 | <!-- receive ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
267 | 301 | ||
268 | <p class=name id=receive> | 302 | <p class=name id="receive"> |
269 | client:<b>receive(</b>[pattern [, prefix]]<b>)</b> | 303 | client:<b>receive(</b>[pattern [, prefix]]<b>)</b> |
270 | </p> | 304 | </p> |
271 | 305 | ||
@@ -316,7 +350,7 @@ too. | |||
316 | 350 | ||
317 | <!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 351 | <!-- send +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
318 | 352 | ||
319 | <p class=name id=send> | 353 | <p class=name id="send"> |
320 | client:<b>send(</b>data [, i [, j]]<b>)</b> | 354 | client:<b>send(</b>data [, i [, j]]<b>)</b> |
321 | </p> | 355 | </p> |
322 | 356 | ||
@@ -354,7 +388,7 @@ instead of calling the method several times. | |||
354 | 388 | ||
355 | <!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 389 | <!-- setoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
356 | 390 | ||
357 | <p class=name id=setoption> | 391 | <p class=name id="setoption"> |
358 | client:<b>setoption(</b>option [, value]<b>)</b><br> | 392 | client:<b>setoption(</b>option [, value]<b>)</b><br> |
359 | server:<b>setoption(</b>option [, value]<b>)</b> | 393 | server:<b>setoption(</b>option [, value]<b>)</b> |
360 | </p> | 394 | </p> |
@@ -392,8 +426,11 @@ used in validating addresses supplied in a call to | |||
392 | <a href=#bind><tt>bind</tt></a> should allow reuse of local addresses; | 426 | <a href=#bind><tt>bind</tt></a> should allow reuse of local addresses; |
393 | 427 | ||
394 | <li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt> | 428 | <li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt> |
395 | disables the Nagle's algorithm for the connection. | 429 | disables the Nagle's algorithm for the connection; |
396 | 430 | ||
431 | <li> '<tt>ipv6-v6only</tt>': | ||
432 | Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to | ||
433 | sending and receiving only IPv6 packets. | ||
397 | </ul> | 434 | </ul> |
398 | 435 | ||
399 | <p class=return> | 436 | <p class=return> |
@@ -407,7 +444,7 @@ Note: The descriptions above come from the man pages. | |||
407 | 444 | ||
408 | <!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 445 | <!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
409 | 446 | ||
410 | <p class=name id=getoption> | 447 | <p class=name id="getoption"> |
411 | client:<b>getoption(</b>option)</b><br> | 448 | client:<b>getoption(</b>option)</b><br> |
412 | server:<b>getoption(</b>option)</b> | 449 | server:<b>getoption(</b>option)</b> |
413 | </p> | 450 | </p> |
@@ -433,13 +470,9 @@ The method returns the option <tt>value</tt> in case of success, or | |||
433 | <b><tt>nil</tt></b> followed by an error message otherwise. | 470 | <b><tt>nil</tt></b> followed by an error message otherwise. |
434 | </p> | 471 | </p> |
435 | 472 | ||
436 | <p class=note> | ||
437 | Note: The descriptions above come from the man pages. | ||
438 | </p> | ||
439 | |||
440 | <!-- setstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 473 | <!-- setstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
441 | 474 | ||
442 | <p class=name id=setstats> | 475 | <p class=name id="setstats"> |
443 | master:<b>setstats(</b>received, sent, age<b>)</b><br> | 476 | master:<b>setstats(</b>received, sent, age<b>)</b><br> |
444 | client:<b>setstats(</b>received, sent, age<b>)</b><br> | 477 | client:<b>setstats(</b>received, sent, age<b>)</b><br> |
445 | server:<b>setstats(</b>received, sent, age<b>)</b><br> | 478 | server:<b>setstats(</b>received, sent, age<b>)</b><br> |
@@ -462,7 +495,7 @@ The method returns 1 in case of success and <tt><b>nil</b></tt> otherwise. | |||
462 | 495 | ||
463 | <!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 496 | <!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
464 | 497 | ||
465 | <p class=name id=settimeout> | 498 | <p class=name id="settimeout"> |
466 | master:<b>settimeout(</b>value [, mode]<b>)</b><br> | 499 | master:<b>settimeout(</b>value [, mode]<b>)</b><br> |
467 | client:<b>settimeout(</b>value [, mode]<b>)</b><br> | 500 | client:<b>settimeout(</b>value [, mode]<b>)</b><br> |
468 | server:<b>settimeout(</b>value [, mode]<b>)</b> | 501 | server:<b>settimeout(</b>value [, mode]<b>)</b> |
@@ -519,7 +552,7 @@ contained verbs making their imperative nature obvious. | |||
519 | 552 | ||
520 | <!-- shutdown +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 553 | <!-- shutdown +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
521 | 554 | ||
522 | <p class=name id=shutdown> | 555 | <p class=name id="shutdown"> |
523 | client:<b>shutdown(</b>mode<b>)</b><br> | 556 | client:<b>shutdown(</b>mode<b>)</b><br> |
524 | </p> | 557 | </p> |
525 | 558 | ||
@@ -543,7 +576,7 @@ This function returns 1. | |||
543 | 576 | ||
544 | <!-- dirty +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 577 | <!-- dirty +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
545 | 578 | ||
546 | <p class=name id=dirty> | 579 | <p class=name id="dirty"> |
547 | master:<b>dirty()</b><br> | 580 | master:<b>dirty()</b><br> |
548 | client:<b>dirty()</b><br> | 581 | client:<b>dirty()</b><br> |
549 | server:<b>dirty()</b> | 582 | server:<b>dirty()</b> |
@@ -563,7 +596,7 @@ Note: <b>This is an internal method, any use is unlikely to be portable.</b> | |||
563 | 596 | ||
564 | <!-- getfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 597 | <!-- getfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
565 | 598 | ||
566 | <p class=name id=getfd> | 599 | <p class=name id="getfd"> |
567 | master:<b>getfd()</b><br> | 600 | master:<b>getfd()</b><br> |
568 | client:<b>getfd()</b><br> | 601 | client:<b>getfd()</b><br> |
569 | server:<b>getfd()</b> | 602 | server:<b>getfd()</b> |
@@ -583,7 +616,7 @@ Note: <b>This is an internal method, any use is unlikely to be portable.</b> | |||
583 | 616 | ||
584 | <!-- setfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 617 | <!-- setfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
585 | 618 | ||
586 | <p class=name id=setfd> | 619 | <p class=name id="setfd"> |
587 | master:<b>setfd(</b>fd<b>)</b><br> | 620 | master:<b>setfd(</b>fd<b>)</b><br> |
588 | client:<b>setfd(</b>fd<b>)</b><br> | 621 | client:<b>setfd(</b>fd<b>)</b><br> |
589 | server:<b>setfd(</b>fd<b>)</b> | 622 | server:<b>setfd(</b>fd<b>)</b> |