aboutsummaryrefslogtreecommitdiff
path: root/doc/tcp.html
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2012-04-17 01:15:26 +0800
committerDiego Nehab <diego.nehab@gmail.com>2012-04-17 01:15:26 +0800
commitf37e0260261f7691246429d227cf7124c291e8b1 (patch)
tree7e84322c8852d4227e36958af1132a4588f64795 /doc/tcp.html
parentb3c4f46179ed5b27ca76a824f8730fa50dbaae0b (diff)
downloadluasocket-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.html85
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">
44socket.<b>tcp()</b> 44socket.<b>tcp()</b>
45</p> 45</p>
46 46
47<p class=description> 47<p class=description>
48Creates and returns a TCP master object. A master object can 48Creates and returns an IPv4 TCP master object. A master object can
49be transformed into a server object with the method 49be 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
51href=#bind><tt>bind</tt></a>) or into a client object with 51href=#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">
64socket.<b>tcp6()</b>
65</p>
66
67<p class=description>
68Creates and returns an IPv6 TCP master object. A master object can
69be transformed into a server object with the method
70<a href=#listen><tt>listen</tt></a> (after a call to <a
71href=#bind><tt>bind</tt></a>) or into a client object with
72the method <a href=#connect><tt>connect</tt></a>. The only other
73method supported by a master object is the
74<a href=#close><tt>close</tt></a> method.</p>
75
76<p class=return>
77In 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>
82Note: 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">
64server:<b>accept()</b> 89server:<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">
91master:<b>bind(</b>address, port<b>)</b> 116master:<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">
120master:<b>close()</b><br> 145master:<b>close()</b><br>
121client:<b>close()</b><br> 146client:<b>close()</b><br>
122server:<b>close()</b> 147server:<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">
143master:<b>connect(</b>address, port<b>)</b> 168master:<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
180established. 205established.
181</p> 206</p>
182 207
208<p class=note>
209Note: Starting with LuaSocket 2.1, the host name resolution
210depends on whether the socket was created by <a
211href=#socket.tcp><tt>socket.tcp</tt></a> or <a
212href=#socket.tcp6><tt>socket.tcp6</tt></a>. Addresses from
213the appropriate family are tried in succession until the
214first 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">
186client:<b>getpeername()</b> 220client:<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">
206master:<b>getsockname()</b><br> 240master:<b>getsockname()</b><br>
207client:<b>getsockname()</b><br> 241client:<b>getsockname()</b><br>
208server:<b>getsockname()</b> 242server:<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">
223master:<b>getstats()</b><br> 257master:<b>getstats()</b><br>
224client:<b>getstats()</b><br> 258client:<b>getstats()</b><br>
225server:<b>getstats()</b><br> 259server:<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">
241master:<b>listen(</b>backlog<b>)</b> 275master:<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">
269client:<b>receive(</b>[pattern [, prefix]]<b>)</b> 303client:<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">
320client:<b>send(</b>data [, i [, j]]<b>)</b> 354client:<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">
358client:<b>setoption(</b>option [, value]<b>)</b><br> 392client:<b>setoption(</b>option [, value]<b>)</b><br>
359server:<b>setoption(</b>option [, value]<b>)</b> 393server:<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>
395disables the Nagle's algorithm for the connection. 429disables the Nagle's algorithm for the connection;
396 430
431<li> '<tt>ipv6-v6only</tt>':
432Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to
433sending 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">
411client:<b>getoption(</b>option)</b><br> 448client:<b>getoption(</b>option)</b><br>
412server:<b>getoption(</b>option)</b> 449server:<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>
437Note: 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">
443master:<b>setstats(</b>received, sent, age<b>)</b><br> 476master:<b>setstats(</b>received, sent, age<b>)</b><br>
444client:<b>setstats(</b>received, sent, age<b>)</b><br> 477client:<b>setstats(</b>received, sent, age<b>)</b><br>
445server:<b>setstats(</b>received, sent, age<b>)</b><br> 478server:<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">
466master:<b>settimeout(</b>value [, mode]<b>)</b><br> 499master:<b>settimeout(</b>value [, mode]<b>)</b><br>
467client:<b>settimeout(</b>value [, mode]<b>)</b><br> 500client:<b>settimeout(</b>value [, mode]<b>)</b><br>
468server:<b>settimeout(</b>value [, mode]<b>)</b> 501server:<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">
523client:<b>shutdown(</b>mode<b>)</b><br> 556client:<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">
547master:<b>dirty()</b><br> 580master:<b>dirty()</b><br>
548client:<b>dirty()</b><br> 581client:<b>dirty()</b><br>
549server:<b>dirty()</b> 582server:<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">
567master:<b>getfd()</b><br> 600master:<b>getfd()</b><br>
568client:<b>getfd()</b><br> 601client:<b>getfd()</b><br>
569server:<b>getfd()</b> 602server:<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">
587master:<b>setfd(</b>fd<b>)</b><br> 620master:<b>setfd(</b>fd<b>)</b><br>
588client:<b>setfd(</b>fd<b>)</b><br> 621client:<b>setfd(</b>fd<b>)</b><br>
589server:<b>setfd(</b>fd<b>)</b> 622server:<b>setfd(</b>fd<b>)</b>