aboutsummaryrefslogtreecommitdiff
path: root/doc/tcp.html
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2016-03-04 15:36:32 -0300
committerDiego Nehab <diego.nehab@gmail.com>2016-03-04 15:36:32 -0300
commit944305dc21350fd2ec32a9552d893da86894fd62 (patch)
tree82948c24dade5e0da6924ab5e706f146bce4692a /doc/tcp.html
parentcdce73b226cc4da6a073b79bec02a6780d32ff1a (diff)
downloadluasocket-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.html283
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">
44socket.<b>tcp()</b>
45</p>
46
47<p class=description>
48Creates and returns an TCP master object. A master object can
49be transformed into a server object with the method
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
52the method <a href=#connect><tt>connect</tt></a>. The only other
53method supported by a master object is the
54<a href=#close><tt>close</tt></a> method.</p>
55
56<p class=return>
57In 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>
62Note: The choice between IPv4 and IPv6 happens during a call to
63<a href=#bind><tt>bind</tt></a> or <a
64href=#bind><tt>connect</tt></a>, depending on the address
65family obtained from the resolver.
66</p>
67
68<p class=note>
69Note: Before the choice between IPv4 and IPv6 happens,
70the internal socket object is invalid and therefore <a
71href=#setoption><tt>setoption</tt></a> will fail.
72</p>
73
74<!-- socket.tcp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
75
76<p class=name id="socket.tcp4">
77socket.<b>tcp4()</b>
78</p>
79
80<p class=description>
81Creates and returns an IPv4 TCP master object. A master object can
82be transformed into a server object with the method
83<a href=#listen><tt>listen</tt></a> (after a call to <a
84href=#bind><tt>bind</tt></a>) or into a client object with
85the method <a href=#connect><tt>connect</tt></a>. The only other
86method supported by a master object is the
87<a href=#close><tt>close</tt></a> method.</p>
88
89<p class=return>
90In 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">
97socket.<b>tcp6()</b>
98</p>
99
100<p class=description>
101Creates and returns an IPv6 TCP master object. A master object can
102be transformed into a server object with the method
103<a href=#listen><tt>listen</tt></a> (after a call to <a
104href=#bind><tt>bind</tt></a>) or into a client object with
105the method <a href=#connect><tt>connect</tt></a>. The only other
106method supported by a master object is the
107<a href=#close><tt>close</tt></a> method.</p>
108
109<p class=return>
110In 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>
115Note: 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
252set to zero, only the first address is tried. 174set to zero, only the first address is tried.
253</p> 175</p>
254 176
177<!-- dirty +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
178
179<p class=name id="dirty">
180master:<b>dirty()</b><br>
181client:<b>dirty()</b><br>
182server:<b>dirty()</b>
183</p>
184
185<p class=description>
186Check the read buffer status.
187</p>
188
189<p class=return>
190Returns <tt>true</tt> if there is any data in the read buffer, <tt>false</tt> otherwise.
191</p>
192
193<p class=note>
194Note: <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">
201master:<b>getfd()</b><br>
202client:<b>getfd()</b><br>
203server:<b>getfd()</b>
204</p>
205
206<p class=description>
207Returns the underling socket descriptor or handle associated to the object.
208</p>
209
210<p class=return>
211The descriptor or handle. In case the object has been closed, the return will be -1.
212</p>
213
214<p class=note>
215Note: <b>This is an internal method. Unlikely to be
216portable. Use at your own risk. </b>
217</p>
218
219
220<!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
221
222<p class=name id="getoption">
223client:<b>getoption(</b>option)</b><br>
224server:<b>getoption(</b>option)</b>
225</p>
226
227<p class=description>
228Gets options for the TCP object.
229See <a href=#setoption><tt>setoption</tt></a> for description of the
230option 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>
244The 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,
310and the age of the socket object in seconds. 304and the age of the socket object in seconds.
311</p> 305</p>
312 306
307<!-- gettimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
308
309<p class=name id="gettimeout">
310master:<b>gettimeout()</b><br>
311client:<b>gettimeout()</b><br>
312server:<b>gettimeout()</b>
313</p>
314
315<p class=description>
316Returns the current block timeout followed by the curent
317total 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.
483Note: The descriptions above come from the man pages. 491Note: The descriptions above come from the man pages.
484</p> 492</p>
485 493
486<!-- getoption ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
487
488<p class=name id="getoption">
489client:<b>getoption(</b>option)</b><br>
490server:<b>getoption(</b>option)</b>
491</p>
492
493<p class=description>
494Gets options for the TCP object.
495See <a href=#setoption><tt>setoption</tt></a> for description of the
496option 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>
510The 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;
615This function returns 1. 595This 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">
621master:<b>dirty()</b><br> 601master:<b>setfd(</b>fd<b>)</b><br>
622client:<b>dirty()</b><br> 602client:<b>setfd(</b>fd<b>)</b><br>
623server:<b>dirty()</b> 603server:<b>setfd(</b>fd<b>)</b>
624</p> 604</p>
625 605
626<p class=description> 606<p class=description>
627Check the read buffer status. 607Sets 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>
631Returns <tt>true</tt> if there is any data in the read buffer, <tt>false</tt> otherwise. 611No return value.
632</p> 612</p>
633 613
634<p class=note> 614<p class=note>
635Note: <b>This is an internal method, any use is unlikely to be portable.</b> 615Note: <b>This is an internal method. Unlikely to be
616portable. 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">
641master:<b>getfd()</b><br> 622socket.<b>tcp()</b>
642client:<b>getfd()</b><br>
643server:<b>getfd()</b>
644</p> 623</p>
645 624
646<p class=description> 625<p class=description>
647Returns the underling socket descriptor or handle associated to the object. 626Creates and returns an TCP master object. A master object can
648</p> 627be transformed into a server object with the method
628<a href=#listen><tt>listen</tt></a> (after a call to <a
629href=#bind><tt>bind</tt></a>) or into a client object with
630the method <a href=#connect><tt>connect</tt></a>. The only other
631method 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>
651The descriptor or handle. In case the object has been closed, the return will be -1. 635In 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>
640Note: The choice between IPv4 and IPv6 happens during a call to
641<a href=#bind><tt>bind</tt></a> or <a
642href=#bind><tt>connect</tt></a>, depending on the address
643family obtained from the resolver.
652</p> 644</p>
653 645
654<p class=note> 646<p class=note>
655Note: <b>This is an internal method, any use is unlikely to be portable.</b> 647Note: Before the choice between IPv4 and IPv6 happens,
648the internal socket object is invalid and therefore <a
649href=#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">
661master:<b>setfd(</b>fd<b>)</b><br> 655socket.<b>tcp4()</b>
662client:<b>setfd(</b>fd<b>)</b><br>
663server:<b>setfd(</b>fd<b>)</b>
664</p> 656</p>
665 657
666<p class=description> 658<p class=description>
667Sets 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. 659Creates and returns an IPv4 TCP master object. A master object can
660be transformed into a server object with the method
661<a href=#listen><tt>listen</tt></a> (after a call to <a
662href=#bind><tt>bind</tt></a>) or into a client object with
663the method <a href=#connect><tt>connect</tt></a>. The only other
664method supported by a master object is the
665<a href=#close><tt>close</tt></a> method.</p>
666
667<p class=return>
668In 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">
675socket.<b>tcp6()</b>
668</p> 676</p>
669 677
678<p class=description>
679Creates and returns an IPv6 TCP master object. A master object can
680be transformed into a server object with the method
681<a href=#listen><tt>listen</tt></a> (after a call to <a
682href=#bind><tt>bind</tt></a>) or into a client object with
683the method <a href=#connect><tt>connect</tt></a>. The only other
684method 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>
671No return value. 688In 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>
675Note: <b>This is an internal method, any use is unlikely to be portable.</b> 693Note: 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>