diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2016-03-04 15:36:32 -0300 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2016-03-04 15:36:32 -0300 |
commit | 944305dc21350fd2ec32a9552d893da86894fd62 (patch) | |
tree | 82948c24dade5e0da6924ab5e706f146bce4692a /doc/tcp.html | |
parent | cdce73b226cc4da6a073b79bec02a6780d32ff1a (diff) | |
download | luasocket-944305dc21350fd2ec32a9552d893da86894fd62.tar.gz luasocket-944305dc21350fd2ec32a9552d893da86894fd62.tar.bz2 luasocket-944305dc21350fd2ec32a9552d893da86894fd62.zip |
Added gettimeout for completeness.
Also documented.
Rordered manuals so order is alphabetical.
Diffstat (limited to 'doc/tcp.html')
-rw-r--r-- | doc/tcp.html | 283 |
1 files changed, 152 insertions, 131 deletions
diff --git a/doc/tcp.html b/doc/tcp.html index c86853d..c6c6eb2 100644 --- a/doc/tcp.html +++ b/doc/tcp.html | |||
@@ -38,84 +38,6 @@ | |||
38 | 38 | ||
39 | <h2 id="tcp">TCP</h2> | 39 | <h2 id="tcp">TCP</h2> |
40 | 40 | ||
41 | <!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
42 | |||
43 | <p class=name id="socket.tcp"> | ||
44 | socket.<b>tcp()</b> | ||
45 | </p> | ||
46 | |||
47 | <p class=description> | ||
48 | Creates and returns an TCP master object. A master object can | ||
49 | be transformed into a server object with the method | ||
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 | ||
52 | the method <a href=#connect><tt>connect</tt></a>. The only other | ||
53 | method supported by a master object is the | ||
54 | <a href=#close><tt>close</tt></a> method.</p> | ||
55 | |||
56 | <p class=return> | ||
57 | 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. | ||
59 | </p> | ||
60 | |||
61 | <p class=note> | ||
62 | Note: The choice between IPv4 and IPv6 happens during a call to | ||
63 | <a href=#bind><tt>bind</tt></a> or <a | ||
64 | href=#bind><tt>connect</tt></a>, depending on the address | ||
65 | family obtained from the resolver. | ||
66 | </p> | ||
67 | |||
68 | <p class=note> | ||
69 | Note: Before the choice between IPv4 and IPv6 happens, | ||
70 | the internal socket object is invalid and therefore <a | ||
71 | href=#setoption><tt>setoption</tt></a> will fail. | ||
72 | </p> | ||
73 | |||
74 | <!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
75 | |||
76 | <p class=name id="socket.tcp4"> | ||
77 | socket.<b>tcp4()</b> | ||
78 | </p> | ||
79 | |||
80 | <p class=description> | ||
81 | Creates and returns an IPv4 TCP master object. A master object can | ||
82 | be transformed into a server object with the method | ||
83 | <a href=#listen><tt>listen</tt></a> (after a call to <a | ||
84 | href=#bind><tt>bind</tt></a>) or into a client object with | ||
85 | the method <a href=#connect><tt>connect</tt></a>. The only other | ||
86 | method supported by a master object is the | ||
87 | <a href=#close><tt>close</tt></a> method.</p> | ||
88 | |||
89 | <p class=return> | ||
90 | In case of success, a new master object is returned. In case of error, | ||
91 | <b><tt>nil</tt></b> is returned, followed by an error message. | ||
92 | </p> | ||
93 | |||
94 | <!-- socket.tcp6 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
95 | |||
96 | <p class=name id="socket.tcp6"> | ||
97 | socket.<b>tcp6()</b> | ||
98 | </p> | ||
99 | |||
100 | <p class=description> | ||
101 | Creates and returns an IPv6 TCP master object. A master object can | ||
102 | be transformed into a server object with the method | ||
103 | <a href=#listen><tt>listen</tt></a> (after a call to <a | ||
104 | href=#bind><tt>bind</tt></a>) or into a client object with | ||
105 | the method <a href=#connect><tt>connect</tt></a>. The only other | ||
106 | method supported by a master object is the | ||
107 | <a href=#close><tt>close</tt></a> method.</p> | ||
108 | |||
109 | <p class=return> | ||
110 | In case of success, a new master object is returned. In case of error, | ||
111 | <b><tt>nil</tt></b> is returned, followed by an error message. | ||
112 | </p> | ||
113 | |||
114 | <p class=note> | ||
115 | Note: The TCP object returned will have the option | ||
116 | "<tt>ipv6-v6only</tt>" set to <tt><b>true</b></tt>. | ||
117 | </p> | ||
118 | |||
119 | <!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 41 | <!-- accept +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
120 | 42 | ||
121 | <p class=name id="accept"> | 43 | <p class=name id="accept"> |
@@ -252,6 +174,78 @@ first success or until the last failure. If the timeout was | |||
252 | set to zero, only the first address is tried. | 174 | set to zero, only the first address is tried. |
253 | </p> | 175 | </p> |
254 | 176 | ||
177 | <!-- dirty +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
178 | |||
179 | <p class=name id="dirty"> | ||
180 | master:<b>dirty()</b><br> | ||
181 | client:<b>dirty()</b><br> | ||
182 | server:<b>dirty()</b> | ||
183 | </p> | ||
184 | |||
185 | <p class=description> | ||
186 | Check the read buffer status. | ||
187 | </p> | ||
188 | |||
189 | <p class=return> | ||
190 | Returns <tt>true</tt> if there is any data in the read buffer, <tt>false</tt> otherwise. | ||
191 | </p> | ||
192 | |||
193 | <p class=note> | ||
194 | Note: <b>This is an internal method, use at your own risk.</b> | ||
195 | </p> | ||
196 | |||
197 | |||
198 | <!-- getfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
199 | |||
200 | <p class=name id="getfd"> | ||
201 | master:<b>getfd()</b><br> | ||
202 | client:<b>getfd()</b><br> | ||
203 | server:<b>getfd()</b> | ||
204 | </p> | ||
205 | |||
206 | <p class=description> | ||
207 | Returns the underling socket descriptor or handle associated to the object. | ||
208 | </p> | ||
209 | |||
210 | <p class=return> | ||
211 | The descriptor or handle. In case the object has been closed, the return will be -1. | ||
212 | </p> | ||
213 | |||
214 | <p class=note> | ||
215 | Note: <b>This is an internal method. Unlikely to be | ||
216 | portable. Use at your own risk. </b> | ||
217 | </p> | ||
218 | |||
219 | |||
220 | <!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
221 | |||
222 | <p class=name id="getoption"> | ||
223 | client:<b>getoption(</b>option)</b><br> | ||
224 | server:<b>getoption(</b>option)</b> | ||
225 | </p> | ||
226 | |||
227 | <p class=description> | ||
228 | Gets options for the TCP object. | ||
229 | See <a href=#setoption><tt>setoption</tt></a> for description of the | ||
230 | option names and values. | ||
231 | </p> | ||
232 | |||
233 | <p class=parameters> | ||
234 | <tt>Option</tt> is a string with the option name. | ||
235 | <ul> | ||
236 | |||
237 | <li> '<tt>keepalive</tt>' | ||
238 | <li> '<tt>linger</tt>' | ||
239 | <li> '<tt>reuseaddr</tt>' | ||
240 | <li> '<tt>tcp-nodelay</tt>' | ||
241 | </ul> | ||
242 | |||
243 | <p class=return> | ||
244 | The method returns the option <tt>value</tt> in case of success, or | ||
245 | <b><tt>nil</tt></b> followed by an error message otherwise. | ||
246 | </p> | ||
247 | |||
248 | |||
255 | <!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 249 | <!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
256 | 250 | ||
257 | <p class=name id="getpeername"> | 251 | <p class=name id="getpeername"> |
@@ -310,6 +304,20 @@ The method returns the number of bytes received, the number of bytes sent, | |||
310 | and the age of the socket object in seconds. | 304 | and the age of the socket object in seconds. |
311 | </p> | 305 | </p> |
312 | 306 | ||
307 | <!-- gettimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
308 | |||
309 | <p class=name id="gettimeout"> | ||
310 | master:<b>gettimeout()</b><br> | ||
311 | client:<b>gettimeout()</b><br> | ||
312 | server:<b>gettimeout()</b> | ||
313 | </p> | ||
314 | |||
315 | <p class=description> | ||
316 | Returns the current block timeout followed by the curent | ||
317 | total timeout. | ||
318 | </p> | ||
319 | |||
320 | |||
313 | <!-- listen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 321 | <!-- listen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
314 | 322 | ||
315 | <p class=name id="listen"> | 323 | <p class=name id="listen"> |
@@ -483,34 +491,6 @@ followed by an error message otherwise. | |||
483 | Note: The descriptions above come from the man pages. | 491 | Note: The descriptions above come from the man pages. |
484 | </p> | 492 | </p> |
485 | 493 | ||
486 | <!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
487 | |||
488 | <p class=name id="getoption"> | ||
489 | client:<b>getoption(</b>option)</b><br> | ||
490 | server:<b>getoption(</b>option)</b> | ||
491 | </p> | ||
492 | |||
493 | <p class=description> | ||
494 | Gets options for the TCP object. | ||
495 | See <a href=#setoption><tt>setoption</tt></a> for description of the | ||
496 | option names and values. | ||
497 | </p> | ||
498 | |||
499 | <p class=parameters> | ||
500 | <tt>Option</tt> is a string with the option name. | ||
501 | <ul> | ||
502 | |||
503 | <li> '<tt>keepalive</tt>' | ||
504 | <li> '<tt>linger</tt>' | ||
505 | <li> '<tt>reuseaddr</tt>' | ||
506 | <li> '<tt>tcp-nodelay</tt>' | ||
507 | </ul> | ||
508 | |||
509 | <p class=return> | ||
510 | The method returns the option <tt>value</tt> in case of success, or | ||
511 | <b><tt>nil</tt></b> followed by an error message otherwise. | ||
512 | </p> | ||
513 | |||
514 | <!-- setstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 494 | <!-- setstats +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
515 | 495 | ||
516 | <p class=name id="setstats"> | 496 | <p class=name id="setstats"> |
@@ -615,66 +595,107 @@ This is the default mode; | |||
615 | This function returns 1. | 595 | This function returns 1. |
616 | </p> | 596 | </p> |
617 | 597 | ||
618 | <!-- dirty +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 598 | <!-- setfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
619 | 599 | ||
620 | <p class=name id="dirty"> | 600 | <p class=name id="setfd"> |
621 | master:<b>dirty()</b><br> | 601 | master:<b>setfd(</b>fd<b>)</b><br> |
622 | client:<b>dirty()</b><br> | 602 | client:<b>setfd(</b>fd<b>)</b><br> |
623 | server:<b>dirty()</b> | 603 | server:<b>setfd(</b>fd<b>)</b> |
624 | </p> | 604 | </p> |
625 | 605 | ||
626 | <p class=description> | 606 | <p class=description> |
627 | Check the read buffer status. | 607 | Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made. |
628 | </p> | 608 | </p> |
629 | 609 | ||
630 | <p class=return> | 610 | <p class=return> |
631 | Returns <tt>true</tt> if there is any data in the read buffer, <tt>false</tt> otherwise. | 611 | No return value. |
632 | </p> | 612 | </p> |
633 | 613 | ||
634 | <p class=note> | 614 | <p class=note> |
635 | Note: <b>This is an internal method, any use is unlikely to be portable.</b> | 615 | Note: <b>This is an internal method. Unlikely to be |
616 | portable. Use at your own risk. </b> | ||
636 | </p> | 617 | </p> |
637 | 618 | ||
638 | <!-- getfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 619 | <!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
639 | 620 | ||
640 | <p class=name id="getfd"> | 621 | <p class=name id="socket.tcp"> |
641 | master:<b>getfd()</b><br> | 622 | socket.<b>tcp()</b> |
642 | client:<b>getfd()</b><br> | ||
643 | server:<b>getfd()</b> | ||
644 | </p> | 623 | </p> |
645 | 624 | ||
646 | <p class=description> | 625 | <p class=description> |
647 | Returns the underling socket descriptor or handle associated to the object. | 626 | Creates and returns an TCP master object. A master object can |
648 | </p> | 627 | be transformed into a server object with the method |
628 | <a href=#listen><tt>listen</tt></a> (after a call to <a | ||
629 | href=#bind><tt>bind</tt></a>) or into a client object with | ||
630 | the method <a href=#connect><tt>connect</tt></a>. The only other | ||
631 | method supported by a master object is the | ||
632 | <a href=#close><tt>close</tt></a> method.</p> | ||
649 | 633 | ||
650 | <p class=return> | 634 | <p class=return> |
651 | The descriptor or handle. In case the object has been closed, the return will be -1. | 635 | In case of success, a new master object is returned. In case of error, |
636 | <b><tt>nil</tt></b> is returned, followed by an error message. | ||
637 | </p> | ||
638 | |||
639 | <p class=note> | ||
640 | Note: The choice between IPv4 and IPv6 happens during a call to | ||
641 | <a href=#bind><tt>bind</tt></a> or <a | ||
642 | href=#bind><tt>connect</tt></a>, depending on the address | ||
643 | family obtained from the resolver. | ||
652 | </p> | 644 | </p> |
653 | 645 | ||
654 | <p class=note> | 646 | <p class=note> |
655 | Note: <b>This is an internal method, any use is unlikely to be portable.</b> | 647 | Note: Before the choice between IPv4 and IPv6 happens, |
648 | the internal socket object is invalid and therefore <a | ||
649 | href=#setoption><tt>setoption</tt></a> will fail. | ||
656 | </p> | 650 | </p> |
657 | 651 | ||
658 | <!-- setfd +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 652 | <!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
659 | 653 | ||
660 | <p class=name id="setfd"> | 654 | <p class=name id="socket.tcp4"> |
661 | master:<b>setfd(</b>fd<b>)</b><br> | 655 | socket.<b>tcp4()</b> |
662 | client:<b>setfd(</b>fd<b>)</b><br> | ||
663 | server:<b>setfd(</b>fd<b>)</b> | ||
664 | </p> | 656 | </p> |
665 | 657 | ||
666 | <p class=description> | 658 | <p class=description> |
667 | Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made. | 659 | Creates and returns an IPv4 TCP master object. A master object can |
660 | be transformed into a server object with the method | ||
661 | <a href=#listen><tt>listen</tt></a> (after a call to <a | ||
662 | href=#bind><tt>bind</tt></a>) or into a client object with | ||
663 | the method <a href=#connect><tt>connect</tt></a>. The only other | ||
664 | method supported by a master object is the | ||
665 | <a href=#close><tt>close</tt></a> method.</p> | ||
666 | |||
667 | <p class=return> | ||
668 | In case of success, a new master object is returned. In case of error, | ||
669 | <b><tt>nil</tt></b> is returned, followed by an error message. | ||
670 | </p> | ||
671 | |||
672 | <!-- socket.tcp6 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
673 | |||
674 | <p class=name id="socket.tcp6"> | ||
675 | socket.<b>tcp6()</b> | ||
668 | </p> | 676 | </p> |
669 | 677 | ||
678 | <p class=description> | ||
679 | Creates and returns an IPv6 TCP master object. A master object can | ||
680 | be transformed into a server object with the method | ||
681 | <a href=#listen><tt>listen</tt></a> (after a call to <a | ||
682 | href=#bind><tt>bind</tt></a>) or into a client object with | ||
683 | the method <a href=#connect><tt>connect</tt></a>. The only other | ||
684 | method supported by a master object is the | ||
685 | <a href=#close><tt>close</tt></a> method.</p> | ||
686 | |||
670 | <p class=return> | 687 | <p class=return> |
671 | No return value. | 688 | In case of success, a new master object is returned. In case of error, |
689 | <b><tt>nil</tt></b> is returned, followed by an error message. | ||
672 | </p> | 690 | </p> |
673 | 691 | ||
674 | <p class=note> | 692 | <p class=note> |
675 | Note: <b>This is an internal method, any use is unlikely to be portable.</b> | 693 | Note: The TCP object returned will have the option |
694 | "<tt>ipv6-v6only</tt>" set to <tt><b>true</b></tt>. | ||
676 | </p> | 695 | </p> |
677 | 696 | ||
697 | |||
698 | |||
678 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 699 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
679 | 700 | ||
680 | <div class=footer> | 701 | <div class=footer> |