aboutsummaryrefslogtreecommitdiff
path: root/doc/udp.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/udp.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/udp.html')
-rw-r--r--doc/udp.html431
1 files changed, 223 insertions, 208 deletions
diff --git a/doc/udp.html b/doc/udp.html
index 9437c51..4618aad 100644
--- a/doc/udp.html
+++ b/doc/udp.html
@@ -39,112 +39,6 @@
39 39
40<h2 id="udp">UDP</h2> 40<h2 id="udp">UDP</h2>
41 41
42<!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
43
44<p class="name" id="socket.udp">
45socket.<b>udp()</b>
46</p>
47
48<p class="description">
49Creates and returns an unconnected UDP object.
50Unconnected objects support the
51<a href="#sendto"><tt>sendto</tt></a>,
52<a href="#receive"><tt>receive</tt></a>,
53<a href="#receivefrom"><tt>receivefrom</tt></a>,
54<a href="#getoption"><tt>getoption</tt></a>,
55<a href="#getsockname"><tt>getsockname</tt></a>,
56<a href="#setoption"><tt>setoption</tt></a>,
57<a href="#settimeout"><tt>settimeout</tt></a>,
58<a href="#setpeername"><tt>setpeername</tt></a>,
59<a href="#setsockname"><tt>setsockname</tt></a>, and
60<a href="#close"><tt>close</tt></a>.
61The <a href="#setpeername"><tt>setpeername</tt></a>
62is used to connect the object.
63</p>
64
65<p class="return">
66In case of success, a new unconnected UDP object
67returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
68an error message.
69</p>
70
71<p class=note>
72Note: The choice between IPv4 and IPv6 happens during a call to
73<a href=#sendto><tt>sendto</tt></a>, <a
74href=#setpeername><tt>setpeername</tt></a>, or <a
75href=#setsockname><tt>sockname</tt></a>, depending on the address
76family obtained from the resolver.
77</p>
78
79<p class=note>
80Note: Before the choice between IPv4 and IPv6 happens,
81the internal socket object is invalid and therefore <a
82href=#setoption><tt>setoption</tt></a> will fail.
83</p>
84
85<!-- socket.udp4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
86
87<p class="name" id="socket.udp">
88socket.<b>udp4()</b>
89</p>
90
91<p class="description">
92Creates and returns an unconnected IPv4 UDP object.
93Unconnected objects support the
94<a href="#sendto"><tt>sendto</tt></a>,
95<a href="#receive"><tt>receive</tt></a>,
96<a href="#receivefrom"><tt>receivefrom</tt></a>,
97<a href="#getoption"><tt>getoption</tt></a>,
98<a href="#getsockname"><tt>getsockname</tt></a>,
99<a href="#setoption"><tt>setoption</tt></a>,
100<a href="#settimeout"><tt>settimeout</tt></a>,
101<a href="#setpeername"><tt>setpeername</tt></a>,
102<a href="#setsockname"><tt>setsockname</tt></a>, and
103<a href="#close"><tt>close</tt></a>.
104The <a href="#setpeername"><tt>setpeername</tt></a>
105is used to connect the object.
106</p>
107
108<p class="return">
109In case of success, a new unconnected UDP object
110returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
111an error message.
112</p>
113
114<!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
115
116<p class="name" id="socket.udp6">
117socket.<b>udp6()</b>
118</p>
119
120<p class="description">
121Creates and returns an unconnected IPv6 UDP object.
122Unconnected objects support the
123<a href="#sendto"><tt>sendto</tt></a>,
124<a href="#receive"><tt>receive</tt></a>,
125<a href="#receivefrom"><tt>receivefrom</tt></a>,
126<a href="#getoption"><tt>getoption</tt></a>,
127<a href="#getsockname"><tt>getsockname</tt></a>,
128<a href="#setoption"><tt>setoption</tt></a>,
129<a href="#settimeout"><tt>settimeout</tt></a>,
130<a href="#setpeername"><tt>setpeername</tt></a>,
131<a href="#setsockname"><tt>setsockname</tt></a>, and
132<a href="#close"><tt>close</tt></a>.
133The <a href="#setpeername"><tt>setpeername</tt></a>
134is used to connect the object.
135</p>
136
137<p class="return">
138In case of success, a new unconnected UDP object
139returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
140an error message.
141</p>
142
143<p class=note>
144Note: The TCP object returned will have the option
145"<tt>ipv6-v6only</tt>" set to <tt><b>true</b></tt>.
146</p>
147
148<!-- close +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 42<!-- close +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
149 43
150<p class="name" id="close"> 44<p class="name" id="close">
@@ -168,6 +62,40 @@ Garbage-collected objects are automatically closed before
168destruction, though. 62destruction, though.
169</p> 63</p>
170 64
65<!-- getoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
66
67<p class="name" id="getoption">
68connected:<b>getoption()</b><br>
69unconnected:<b>getoption()</b>
70</p>
71
72<p class="description">
73Gets an option value from the UDP object.
74See <a href=#setoption><tt>setoption</tt></a> for
75description of the option names and values.
76</p>
77
78<p class="parameters"><tt>Option</tt> is a string with the option name.
79<ul>
80<li> '<tt>dontroute</tt>'
81<li> '<tt>broadcast</tt>'
82<li> '<tt>reuseaddr</tt>'
83<li> '<tt>reuseport</tt>'
84<li> '<tt>ip-multicast-loop</tt>'
85<li> '<tt>ipv6-v6only</tt>'
86<li> '<tt>ip-multicast-if</tt>'
87<li> '<tt>ip-multicast-ttl</tt>'
88<li> '<tt>ip-add-membership</tt>'
89<li> '<tt>ip-drop-membership</tt>'
90</ul>
91</p>
92
93<p class=return>
94The method returns the option <tt>value</tt> in case of
95success, or
96<b><tt>nil</tt></b> followed by an error message otherwise.
97</p>
98
171<!-- getpeername +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 99<!-- getpeername +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
172 100
173<p class="name" id="getpeername"> 101<p class="name" id="getpeername">
@@ -218,6 +146,18 @@ first time (in which case it is bound to an ephemeral port and the
218wild-card address). 146wild-card address).
219</p> 147</p>
220 148
149<!-- gettimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
150
151<p class=name id="gettimeout">
152connected:<b>settimeout(</b>value<b>)</b><br>
153unconnected:<b>settimeout(</b>value<b>)</b>
154</p>
155
156<p class=description>
157Returns the current timeout value.
158</p>
159
160
221<!-- receive +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 161<!-- receive +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
222 162
223<p class="name" id="receive"> 163<p class="name" id="receive">
@@ -265,40 +205,6 @@ address and port as extra return values (and is therefore slightly less
265efficient). 205efficient).
266</p> 206</p>
267 207
268<!-- getoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
269
270<p class="name" id="getoption">
271connected:<b>getoption()</b><br>
272unconnected:<b>getoption()</b>
273</p>
274
275<p class="description">
276Gets an option value from the UDP object.
277See <a href=#setoption><tt>setoption</tt></a> for
278description of the option names and values.
279</p>
280
281<p class="parameters"><tt>Option</tt> is a string with the option name.
282<ul>
283<li> '<tt>dontroute</tt>'
284<li> '<tt>broadcast</tt>'
285<li> '<tt>reuseaddr</tt>'
286<li> '<tt>reuseport</tt>'
287<li> '<tt>ip-multicast-loop</tt>'
288<li> '<tt>ipv6-v6only</tt>'
289<li> '<tt>ip-multicast-if</tt>'
290<li> '<tt>ip-multicast-ttl</tt>'
291<li> '<tt>ip-add-membership</tt>'
292<li> '<tt>ip-drop-membership</tt>'
293</ul>
294</p>
295
296<p class=return>
297The method returns the option <tt>value</tt> in case of
298success, or
299<b><tt>nil</tt></b> followed by an error message otherwise.
300</p>
301
302<!-- send ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 208<!-- send ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
303 209
304<p class="name" id="send"> 210<p class="name" id="send">
@@ -362,6 +268,75 @@ refuses to send a message to the specified address (i.e. no
362interface accepts the address). 268interface accepts the address).
363</p> 269</p>
364 270
271<!-- setoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
272
273<p class="name" id="setoption">
274connected:<b>setoption(</b>option [, value]<b>)</b><br>
275unconnected:<b>setoption(</b>option [, value]<b>)</b>
276</p>
277
278<p class="description">
279Sets options for the UDP object. Options are
280only needed by low-level or time-critical applications. You should
281only modify an option if you are sure you need it.</p>
282<p class="parameters"><tt>Option</tt> is a string with the option
283name, and <tt>value</tt> depends on the option being set:
284</p>
285
286<ul>
287<li> '<tt>dontroute</tt>': Indicates that outgoing
288messages should bypass the standard routing facilities.
289Receives a boolean value;
290<li> '<tt>broadcast</tt>': Requests permission to send
291broadcast datagrams on the socket.
292Receives a boolean value;
293<li> '<tt>reuseaddr</tt>': Indicates that the rules used in
294validating addresses supplied in a <tt>bind()</tt> call
295should allow reuse of local addresses.
296Receives a boolean value;
297<li> '<tt>reuseport</tt>': Allows completely duplicate
298bindings by multiple processes if they all set
299'<tt>reuseport</tt>' before binding the port.
300Receives a boolean value;
301<li> '<tt>ip-multicast-loop</tt>':
302Specifies whether or not a copy of an outgoing multicast
303datagram is delivered to the sending host as long as it is a
304member of the multicast group.
305Receives a boolean value;
306<li> '<tt>ipv6-v6only</tt>':
307Specifies whether to restrict <tt>inet6</tt> sockets to
308sending and receiving only IPv6 packets.
309Receive a boolean value;
310<li> '<tt>ip-multicast-if</tt>':
311Sets the interface over which outgoing multicast datagrams
312are sent.
313Receives an IP address;
314<li> '<tt>ip-multicast-ttl</tt>':
315Sets the Time To Live in the IP header for outgoing
316multicast datagrams.
317Receives a number;
318<li> '<tt>ip-add-membership</tt>':
319Joins the multicast group specified.
320Receives a table with fields
321<tt>multiaddr</tt> and <tt>interface</tt>, each containing an
322IP address;
323<li> '<tt>ip-drop-membership</tt>': Leaves the multicast
324group specified.
325Receives a table with fields
326<tt>multiaddr</tt> and <tt>interface</tt>, each containing an
327IP address.
328</ul>
329
330<p class="return">
331The method returns 1 in case of success, or
332<b><tt>nil</tt></b> followed by an error message otherwise.
333</p>
334
335<p class=note>
336Note: The descriptions above come from the man pages.
337</p>
338
339
365<!-- setpeername +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 340<!-- setpeername +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
366 341
367<p class="name" id="setpeername"> 342<p class="name" id="setpeername">
@@ -448,74 +423,6 @@ system or explicitly by <tt>setsockname</tt>, it cannot be
448changed. 423changed.
449</p> 424</p>
450 425
451<!-- setoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
452
453<p class="name" id="setoption">
454connected:<b>setoption(</b>option [, value]<b>)</b><br>
455unconnected:<b>setoption(</b>option [, value]<b>)</b>
456</p>
457
458<p class="description">
459Sets options for the UDP object. Options are
460only needed by low-level or time-critical applications. You should
461only modify an option if you are sure you need it.</p>
462<p class="parameters"><tt>Option</tt> is a string with the option
463name, and <tt>value</tt> depends on the option being set:
464</p>
465
466<ul>
467<li> '<tt>dontroute</tt>': Indicates that outgoing
468messages should bypass the standard routing facilities.
469Receives a boolean value;
470<li> '<tt>broadcast</tt>': Requests permission to send
471broadcast datagrams on the socket.
472Receives a boolean value;
473<li> '<tt>reuseaddr</tt>': Indicates that the rules used in
474validating addresses supplied in a <tt>bind()</tt> call
475should allow reuse of local addresses.
476Receives a boolean value;
477<li> '<tt>reuseport</tt>': Allows completely duplicate
478bindings by multiple processes if they all set
479'<tt>reuseport</tt>' before binding the port.
480Receives a boolean value;
481<li> '<tt>ip-multicast-loop</tt>':
482Specifies whether or not a copy of an outgoing multicast
483datagram is delivered to the sending host as long as it is a
484member of the multicast group.
485Receives a boolean value;
486<li> '<tt>ipv6-v6only</tt>':
487Specifies whether to restrict <tt>inet6</tt> sockets to
488sending and receiving only IPv6 packets.
489Receive a boolean value;
490<li> '<tt>ip-multicast-if</tt>':
491Sets the interface over which outgoing multicast datagrams
492are sent.
493Receives an IP address;
494<li> '<tt>ip-multicast-ttl</tt>':
495Sets the Time To Live in the IP header for outgoing
496multicast datagrams.
497Receives a number;
498<li> '<tt>ip-add-membership</tt>':
499Joins the multicast group specified.
500Receives a table with fields
501<tt>multiaddr</tt> and <tt>interface</tt>, each containing an
502IP address;
503<li> '<tt>ip-drop-membership</tt>': Leaves the multicast
504group specified.
505Receives a table with fields
506<tt>multiaddr</tt> and <tt>interface</tt>, each containing an
507IP address.
508</ul>
509
510<p class="return">
511The method returns 1 in case of success, or
512<b><tt>nil</tt></b> followed by an error message otherwise.
513</p>
514
515<p class=note>
516Note: The descriptions above come from the man pages.
517</p>
518
519<!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 426<!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
520 427
521<p class="name" id="settimeout"> 428<p class="name" id="settimeout">
@@ -556,6 +463,114 @@ all other method names already contained verbs making their
556imperative nature obvious. 463imperative nature obvious.
557</p> 464</p>
558 465
466<!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
467
468<p class="name" id="socket.udp">
469socket.<b>udp()</b>
470</p>
471
472<p class="description">
473Creates and returns an unconnected UDP object.
474Unconnected objects support the
475<a href="#sendto"><tt>sendto</tt></a>,
476<a href="#receive"><tt>receive</tt></a>,
477<a href="#receivefrom"><tt>receivefrom</tt></a>,
478<a href="#getoption"><tt>getoption</tt></a>,
479<a href="#getsockname"><tt>getsockname</tt></a>,
480<a href="#setoption"><tt>setoption</tt></a>,
481<a href="#settimeout"><tt>settimeout</tt></a>,
482<a href="#setpeername"><tt>setpeername</tt></a>,
483<a href="#setsockname"><tt>setsockname</tt></a>, and
484<a href="#close"><tt>close</tt></a>.
485The <a href="#setpeername"><tt>setpeername</tt></a>
486is used to connect the object.
487</p>
488
489<p class="return">
490In case of success, a new unconnected UDP object
491returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
492an error message.
493</p>
494
495<p class=note>
496Note: The choice between IPv4 and IPv6 happens during a call to
497<a href=#sendto><tt>sendto</tt></a>, <a
498href=#setpeername><tt>setpeername</tt></a>, or <a
499href=#setsockname><tt>sockname</tt></a>, depending on the address
500family obtained from the resolver.
501</p>
502
503<p class=note>
504Note: Before the choice between IPv4 and IPv6 happens,
505the internal socket object is invalid and therefore <a
506href=#setoption><tt>setoption</tt></a> will fail.
507</p>
508
509<!-- socket.udp4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
510
511<p class="name" id="socket.udp">
512socket.<b>udp4()</b>
513</p>
514
515<p class="description">
516Creates and returns an unconnected IPv4 UDP object.
517Unconnected objects support the
518<a href="#sendto"><tt>sendto</tt></a>,
519<a href="#receive"><tt>receive</tt></a>,
520<a href="#receivefrom"><tt>receivefrom</tt></a>,
521<a href="#getoption"><tt>getoption</tt></a>,
522<a href="#getsockname"><tt>getsockname</tt></a>,
523<a href="#setoption"><tt>setoption</tt></a>,
524<a href="#settimeout"><tt>settimeout</tt></a>,
525<a href="#setpeername"><tt>setpeername</tt></a>,
526<a href="#setsockname"><tt>setsockname</tt></a>, and
527<a href="#close"><tt>close</tt></a>.
528The <a href="#setpeername"><tt>setpeername</tt></a>
529is used to connect the object.
530</p>
531
532<p class="return">
533In case of success, a new unconnected UDP object
534returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
535an error message.
536</p>
537
538<!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
539
540<p class="name" id="socket.udp6">
541socket.<b>udp6()</b>
542</p>
543
544<p class="description">
545Creates and returns an unconnected IPv6 UDP object.
546Unconnected objects support the
547<a href="#sendto"><tt>sendto</tt></a>,
548<a href="#receive"><tt>receive</tt></a>,
549<a href="#receivefrom"><tt>receivefrom</tt></a>,
550<a href="#getoption"><tt>getoption</tt></a>,
551<a href="#getsockname"><tt>getsockname</tt></a>,
552<a href="#setoption"><tt>setoption</tt></a>,
553<a href="#settimeout"><tt>settimeout</tt></a>,
554<a href="#setpeername"><tt>setpeername</tt></a>,
555<a href="#setsockname"><tt>setsockname</tt></a>, and
556<a href="#close"><tt>close</tt></a>.
557The <a href="#setpeername"><tt>setpeername</tt></a>
558is used to connect the object.
559</p>
560
561<p class="return">
562In case of success, a new unconnected UDP object
563returned. In case of error, <b><tt>nil</tt></b> is returned, followed by
564an error message.
565</p>
566
567<p class=note>
568Note: The TCP object returned will have the option
569"<tt>ipv6-v6only</tt>" set to <tt><b>true</b></tt>.
570</p>
571
572
573
559<!-- footer ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 574<!-- footer ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
560 575
561<div class=footer> 576<div class=footer>