diff options
Diffstat (limited to '')
-rw-r--r-- | docs/udp.html (renamed from doc/udp.html) | 464 |
1 files changed, 241 insertions, 223 deletions
diff --git a/doc/udp.html b/docs/udp.html index a300f2f..db711cb 100644 --- a/doc/udp.html +++ b/docs/udp.html | |||
@@ -13,17 +13,17 @@ | |||
13 | 13 | ||
14 | <!-- header ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 14 | <!-- header ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
15 | 15 | ||
16 | <div class=header> | 16 | <div class="header"> |
17 | <hr> | 17 | <hr> |
18 | <center> | 18 | <center> |
19 | <table summary="LuaSocket logo"> | 19 | <table summary="LuaSocket logo"> |
20 | <tr><td align=center><a href="http://www.lua.org"> | 20 | <tr><td align="center"><a href="http://www.lua.org"> |
21 | <img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png"> | 21 | <img width="128" height="128" border="0" alt="LuaSocket" src="luasocket.png"> |
22 | </a></td></tr> | 22 | </a></td></tr> |
23 | <tr><td align=center valign=top>Network support for the Lua language | 23 | <tr><td align="center" valign="top">Network support for the Lua language |
24 | </td></tr> | 24 | </td></tr> |
25 | </table> | 25 | </table> |
26 | <p class=bar> | 26 | <p class="bar"> |
27 | <a href="index.html">home</a> · | 27 | <a href="index.html">home</a> · |
28 | <a href="index.html#download">download</a> · | 28 | <a href="index.html#download">download</a> · |
29 | <a href="installation.html">installation</a> · | 29 | <a href="installation.html">installation</a> · |
@@ -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"> | ||
45 | socket.<b>udp()</b> | ||
46 | </p> | ||
47 | |||
48 | <p class="description"> | ||
49 | Creates and returns an unconnected UDP object. | ||
50 | Unconnected 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>. | ||
61 | The <a href="#setpeername"><tt>setpeername</tt></a> | ||
62 | is used to connect the object. | ||
63 | </p> | ||
64 | |||
65 | <p class="return"> | ||
66 | In case of success, a new unconnected UDP object | ||
67 | returned. In case of error, <b><tt>nil</tt></b> is returned, followed by | ||
68 | an error message. | ||
69 | </p> | ||
70 | |||
71 | <p class=note> | ||
72 | Note: The choice between IPv4 and IPv6 happens during a call to | ||
73 | <a href=#sendto><tt>sendto</tt></a>, <a | ||
74 | href=#setpeername><tt>setpeername</tt></a>, or <a | ||
75 | href=#setsockname><tt>sockname</tt></a>, depending on the address | ||
76 | family obtained from the resolver. | ||
77 | </p> | ||
78 | |||
79 | <p class=note> | ||
80 | Note: Before the choice between IPv4 and IPv6 happens, | ||
81 | the internal socket object is invalid and therefore <a | ||
82 | href=#setoption><tt>setoption</tt></a> will fail. | ||
83 | </p> | ||
84 | |||
85 | <!-- socket.udp4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
86 | |||
87 | <p class="name" id="socket.udp"> | ||
88 | socket.<b>udp4()</b> | ||
89 | </p> | ||
90 | |||
91 | <p class="description"> | ||
92 | Creates and returns an unconnected IPv4 UDP object. | ||
93 | Unconnected 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>. | ||
104 | The <a href="#setpeername"><tt>setpeername</tt></a> | ||
105 | is used to connect the object. | ||
106 | </p> | ||
107 | |||
108 | <p class="return"> | ||
109 | In case of success, a new unconnected UDP object | ||
110 | returned. In case of error, <b><tt>nil</tt></b> is returned, followed by | ||
111 | an error message. | ||
112 | </p> | ||
113 | |||
114 | <!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
115 | |||
116 | <p class="name" id="socket.udp6"> | ||
117 | socket.<b>udp6()</b> | ||
118 | </p> | ||
119 | |||
120 | <p class="description"> | ||
121 | Creates and returns an unconnected IPv6 UDP object. | ||
122 | Unconnected 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>. | ||
133 | The <a href="#setpeername"><tt>setpeername</tt></a> | ||
134 | is used to connect the object. | ||
135 | </p> | ||
136 | |||
137 | <p class="return"> | ||
138 | In case of success, a new unconnected UDP object | ||
139 | returned. In case of error, <b><tt>nil</tt></b> is returned, followed by | ||
140 | an error message. | ||
141 | </p> | ||
142 | |||
143 | <p class=note> | ||
144 | Note: 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 | |||
168 | destruction, though. | 62 | destruction, though. |
169 | </p> | 63 | </p> |
170 | 64 | ||
65 | <!-- getoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
66 | |||
67 | <p class="name" id="getoption"> | ||
68 | connected:<b>getoption()</b><br> | ||
69 | unconnected:<b>getoption()</b> | ||
70 | </p> | ||
71 | |||
72 | <p class="description"> | ||
73 | Gets an option value from the UDP object. | ||
74 | See <a href="#setoption"><tt>setoption</tt></a> for | ||
75 | description 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>'</li> | ||
81 | <li> '<tt>broadcast</tt>'</li> | ||
82 | <li> '<tt>reuseaddr</tt>'</li> | ||
83 | <li> '<tt>reuseport</tt>'</li> | ||
84 | <li> '<tt>ip-multicast-loop</tt>'</li> | ||
85 | <li> '<tt>ipv6-v6only</tt>'</li> | ||
86 | <li> '<tt>ip-multicast-if</tt>'</li> | ||
87 | <li> '<tt>ip-multicast-ttl</tt>'</li> | ||
88 | <li> '<tt>ip-add-membership</tt>'</li> | ||
89 | <li> '<tt>ip-drop-membership</tt>'</li> | ||
90 | </ul> | ||
91 | </p> | ||
92 | |||
93 | <p class="return"> | ||
94 | The method returns the option <tt>value</tt> in case of | ||
95 | success, 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"> |
@@ -180,7 +108,7 @@ associated with a connected UDP object. | |||
180 | </p> | 108 | </p> |
181 | 109 | ||
182 | 110 | ||
183 | <p class=return> | 111 | <p class="return"> |
184 | Returns a string with the IP address of the peer, the | 112 | Returns a string with the IP address of the peer, the |
185 | port number that peer is using for the connection, | 113 | port number that peer is using for the connection, |
186 | and a string with the family ("<tt>inet</tt>" or "<tt>inet6</tt>"). | 114 | and a string with the family ("<tt>inet</tt>" or "<tt>inet6</tt>"). |
@@ -203,7 +131,7 @@ Returns the local address information associated to the object. | |||
203 | </p> | 131 | </p> |
204 | 132 | ||
205 | 133 | ||
206 | <p class=return> | 134 | <p class="return"> |
207 | The method returns a string with local IP address, a number with | 135 | The method returns a string with local IP address, a number with |
208 | the local port, | 136 | the local port, |
209 | and a string with the family ("<tt>inet</tt>" or "<tt>inet6</tt>"). | 137 | and a string with the family ("<tt>inet</tt>" or "<tt>inet6</tt>"). |
@@ -218,6 +146,18 @@ first time (in which case it is bound to an ephemeral port and the | |||
218 | wild-card address). | 146 | wild-card address). |
219 | </p> | 147 | </p> |
220 | 148 | ||
149 | <!-- gettimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
150 | |||
151 | <p class="name" id="gettimeout"> | ||
152 | connected:<b>settimeout(</b>value<b>)</b><br> | ||
153 | unconnected:<b>settimeout(</b>value<b>)</b> | ||
154 | </p> | ||
155 | |||
156 | <p class="description"> | ||
157 | Returns 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"> |
@@ -238,9 +178,12 @@ specifies the maximum size of the datagram to be retrieved. If | |||
238 | there are more than <tt>size</tt> bytes available in the datagram, | 178 | there are more than <tt>size</tt> bytes available in the datagram, |
239 | the excess bytes are discarded. If there are less then | 179 | the excess bytes are discarded. If there are less then |
240 | <tt>size</tt> bytes available in the current datagram, the | 180 | <tt>size</tt> bytes available in the current datagram, the |
241 | available bytes are returned. If <tt>size</tt> is omitted, the | 181 | available bytes are returned. |
242 | maximum datagram size is used (which is currently limited by the | 182 | If <tt>size</tt> is omitted, the |
243 | implementation to 8192 bytes). | 183 | compile-time constant <a href="socket.html#datagramsize"> |
184 | <tt>socket._DATAGRAMSIZE</tt></a> is used | ||
185 | (it defaults to 8192 bytes). Larger sizes will cause a | ||
186 | temporary buffer to be allocated for the operation. | ||
244 | </p> | 187 | </p> |
245 | 188 | ||
246 | <p class="return"> | 189 | <p class="return"> |
@@ -262,40 +205,6 @@ address and port as extra return values (and is therefore slightly less | |||
262 | efficient). | 205 | efficient). |
263 | </p> | 206 | </p> |
264 | 207 | ||
265 | <!-- getoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
266 | |||
267 | <p class="name" id="getoption"> | ||
268 | connected:<b>getoption()</b><br> | ||
269 | unconnected:<b>getoption()</b> | ||
270 | </p> | ||
271 | |||
272 | <p class="description"> | ||
273 | Gets an option value from the UDP object. | ||
274 | See <a href=#setoption><tt>setoption</tt></a> for | ||
275 | description of the option names and values. | ||
276 | </p> | ||
277 | |||
278 | <p class="parameters"><tt>Option</tt> is a string with the option name. | ||
279 | <ul> | ||
280 | <li> '<tt>dontroute</tt>' | ||
281 | <li> '<tt>broadcast</tt>' | ||
282 | <li> '<tt>reuseaddr</tt>' | ||
283 | <li> '<tt>reuseport</tt>' | ||
284 | <li> '<tt>ip-multicast-loop</tt>' | ||
285 | <li> '<tt>ipv6-v6only</tt>' | ||
286 | <li> '<tt>ip-multicast-if</tt>' | ||
287 | <li> '<tt>ip-multicast-ttl</tt>' | ||
288 | <li> '<tt>ip-add-membership</tt>' | ||
289 | <li> '<tt>ip-drop-membership</tt>' | ||
290 | </ul> | ||
291 | </p> | ||
292 | |||
293 | <p class=return> | ||
294 | The method returns the option <tt>value</tt> in case of | ||
295 | success, or | ||
296 | <b><tt>nil</tt></b> followed by an error message otherwise. | ||
297 | </p> | ||
298 | |||
299 | <!-- send ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 208 | <!-- send ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
300 | 209 | ||
301 | <p class="name" id="send"> | 210 | <p class="name" id="send"> |
@@ -359,6 +268,75 @@ refuses to send a message to the specified address (i.e. no | |||
359 | interface accepts the address). | 268 | interface accepts the address). |
360 | </p> | 269 | </p> |
361 | 270 | ||
271 | <!-- setoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
272 | |||
273 | <p class="name" id="setoption"> | ||
274 | connected:<b>setoption(</b>option [, value]<b>)</b><br> | ||
275 | unconnected:<b>setoption(</b>option [, value]<b>)</b> | ||
276 | </p> | ||
277 | |||
278 | <p class="description"> | ||
279 | Sets options for the UDP object. Options are | ||
280 | only needed by low-level or time-critical applications. You should | ||
281 | only modify an option if you are sure you need it.</p> | ||
282 | <p class="parameters"><tt>Option</tt> is a string with the option | ||
283 | name, and <tt>value</tt> depends on the option being set: | ||
284 | </p> | ||
285 | |||
286 | <ul> | ||
287 | <li> '<tt>dontroute</tt>': Indicates that outgoing | ||
288 | messages should bypass the standard routing facilities. | ||
289 | Receives a boolean value;</li> | ||
290 | <li> '<tt>broadcast</tt>': Requests permission to send | ||
291 | broadcast datagrams on the socket. | ||
292 | Receives a boolean value;</li> | ||
293 | <li> '<tt>reuseaddr</tt>': Indicates that the rules used in | ||
294 | validating addresses supplied in a <tt>bind()</tt> call | ||
295 | should allow reuse of local addresses. | ||
296 | Receives a boolean value;</li> | ||
297 | <li> '<tt>reuseport</tt>': Allows completely duplicate | ||
298 | bindings by multiple processes if they all set | ||
299 | '<tt>reuseport</tt>' before binding the port. | ||
300 | Receives a boolean value;</li> | ||
301 | <li> '<tt>ip-multicast-loop</tt>': | ||
302 | Specifies whether or not a copy of an outgoing multicast | ||
303 | datagram is delivered to the sending host as long as it is a | ||
304 | member of the multicast group. | ||
305 | Receives a boolean value;</li> | ||
306 | <li> '<tt>ipv6-v6only</tt>': | ||
307 | Specifies whether to restrict <tt>inet6</tt> sockets to | ||
308 | sending and receiving only IPv6 packets. | ||
309 | Receive a boolean value;</li> | ||
310 | <li> '<tt>ip-multicast-if</tt>': | ||
311 | Sets the interface over which outgoing multicast datagrams | ||
312 | are sent. | ||
313 | Receives an IP address;</li> | ||
314 | <li> '<tt>ip-multicast-ttl</tt>': | ||
315 | Sets the Time To Live in the IP header for outgoing | ||
316 | multicast datagrams. | ||
317 | Receives a number;</li> | ||
318 | <li> '<tt>ip-add-membership</tt>': | ||
319 | Joins the multicast group specified. | ||
320 | Receives a table with fields | ||
321 | <tt>multiaddr</tt> and <tt>interface</tt>, each containing an | ||
322 | IP address;</li> | ||
323 | <li> '<tt>ip-drop-membership</tt>': Leaves the multicast | ||
324 | group specified. | ||
325 | Receives a table with fields | ||
326 | <tt>multiaddr</tt> and <tt>interface</tt>, each containing an | ||
327 | IP address.</li> | ||
328 | </ul> | ||
329 | |||
330 | <p class="return"> | ||
331 | The 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"> | ||
336 | Note: The descriptions above come from the man pages. | ||
337 | </p> | ||
338 | |||
339 | |||
362 | <!-- setpeername +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 340 | <!-- setpeername +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
363 | 341 | ||
364 | <p class="name" id="setpeername"> | 342 | <p class="name" id="setpeername"> |
@@ -403,11 +381,11 @@ is recommended when the same peer is used for several transmissions | |||
403 | and can result in up to 30% performance gains. | 381 | and can result in up to 30% performance gains. |
404 | </p> | 382 | </p> |
405 | 383 | ||
406 | <p class=note> | 384 | <p class="note"> |
407 | Note: Starting with LuaSocket 3.0, the host name resolution | 385 | Note: Starting with LuaSocket 3.0, the host name resolution |
408 | depends on whether the socket was created by <a | 386 | depends on whether the socket was created by <a |
409 | href=#socket.udp><tt>socket.udp</tt></a> or <a | 387 | href="#socket.udp"><tt>socket.udp</tt></a> or <a |
410 | href=#socket.udp6><tt>socket.udp6</tt></a>. Addresses from | 388 | href="#socket.udp6"><tt>socket.udp6</tt></a>. Addresses from |
411 | the appropriate family are tried in succession until the | 389 | the appropriate family are tried in succession until the |
412 | first success or until the last failure. | 390 | first success or until the last failure. |
413 | </p> | 391 | </p> |
@@ -445,74 +423,6 @@ system or explicitly by <tt>setsockname</tt>, it cannot be | |||
445 | changed. | 423 | changed. |
446 | </p> | 424 | </p> |
447 | 425 | ||
448 | <!-- setoption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
449 | |||
450 | <p class="name" id="setoption"> | ||
451 | connected:<b>setoption(</b>option [, value]<b>)</b><br> | ||
452 | unconnected:<b>setoption(</b>option [, value]<b>)</b> | ||
453 | </p> | ||
454 | |||
455 | <p class="description"> | ||
456 | Sets options for the UDP object. Options are | ||
457 | only needed by low-level or time-critical applications. You should | ||
458 | only modify an option if you are sure you need it.</p> | ||
459 | <p class="parameters"><tt>Option</tt> is a string with the option | ||
460 | name, and <tt>value</tt> depends on the option being set: | ||
461 | </p> | ||
462 | |||
463 | <ul> | ||
464 | <li> '<tt>dontroute</tt>': Indicates that outgoing | ||
465 | messages should bypass the standard routing facilities. | ||
466 | Receives a boolean value; | ||
467 | <li> '<tt>broadcast</tt>': Requests permission to send | ||
468 | broadcast datagrams on the socket. | ||
469 | Receives a boolean value; | ||
470 | <li> '<tt>reuseaddr</tt>': Indicates that the rules used in | ||
471 | validating addresses supplied in a <tt>bind()</tt> call | ||
472 | should allow reuse of local addresses. | ||
473 | Receives a boolean value; | ||
474 | <li> '<tt>reuseport</tt>': Allows completely duplicate | ||
475 | bindings by multiple processes if they all set | ||
476 | '<tt>reuseport</tt>' before binding the port. | ||
477 | Receives a boolean value; | ||
478 | <li> '<tt>ip-multicast-loop</tt>': | ||
479 | Specifies whether or not a copy of an outgoing multicast | ||
480 | datagram is delivered to the sending host as long as it is a | ||
481 | member of the multicast group. | ||
482 | Receives a boolean value; | ||
483 | <li> '<tt>ipv6-v6only</tt>': | ||
484 | Specifies whether to restrict <tt>inet6</tt> sockets to | ||
485 | sending and receiving only IPv6 packets. | ||
486 | Receive a boolean value; | ||
487 | <li> '<tt>ip-multicast-if</tt>': | ||
488 | Sets the interface over which outgoing multicast datagrams | ||
489 | are sent. | ||
490 | Receives an IP address; | ||
491 | <li> '<tt>ip-multicast-ttl</tt>': | ||
492 | Sets the Time To Live in the IP header for outgoing | ||
493 | multicast datagrams. | ||
494 | Receives a number; | ||
495 | <li> '<tt>ip-add-membership</tt>': | ||
496 | Joins the multicast group specified. | ||
497 | Receives a table with fields | ||
498 | <tt>multiaddr</tt> and <tt>interface</tt>, each containing an | ||
499 | IP address; | ||
500 | <li> '<tt>ip-drop-membership</tt>': Leaves the multicast | ||
501 | group specified. | ||
502 | Receives a table with fields | ||
503 | <tt>multiaddr</tt> and <tt>interface</tt>, each containing an | ||
504 | IP address. | ||
505 | </ul> | ||
506 | |||
507 | <p class="return"> | ||
508 | The method returns 1 in case of success, or | ||
509 | <b><tt>nil</tt></b> followed by an error message otherwise. | ||
510 | </p> | ||
511 | |||
512 | <p class=note> | ||
513 | Note: The descriptions above come from the man pages. | ||
514 | </p> | ||
515 | |||
516 | <!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 426 | <!-- settimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
517 | 427 | ||
518 | <p class="name" id="settimeout"> | 428 | <p class="name" id="settimeout"> |
@@ -553,12 +463,120 @@ all other method names already contained verbs making their | |||
553 | imperative nature obvious. | 463 | imperative nature obvious. |
554 | </p> | 464 | </p> |
555 | 465 | ||
466 | <!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
467 | |||
468 | <p class="name" id="socket.udp"> | ||
469 | socket.<b>udp()</b> | ||
470 | </p> | ||
471 | |||
472 | <p class="description"> | ||
473 | Creates and returns an unconnected UDP object. | ||
474 | Unconnected 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>. | ||
485 | The <a href="#setpeername"><tt>setpeername</tt></a> | ||
486 | is used to connect the object. | ||
487 | </p> | ||
488 | |||
489 | <p class="return"> | ||
490 | In case of success, a new unconnected UDP object | ||
491 | returned. In case of error, <b><tt>nil</tt></b> is returned, followed by | ||
492 | an error message. | ||
493 | </p> | ||
494 | |||
495 | <p class="note"> | ||
496 | Note: The choice between IPv4 and IPv6 happens during a call to | ||
497 | <a href="#sendto"><tt>sendto</tt></a>, <a | ||
498 | href="#setpeername"><tt>setpeername</tt></a>, or <a | ||
499 | href="#setsockname"><tt>sockname</tt></a>, depending on the address | ||
500 | family obtained from the resolver. | ||
501 | </p> | ||
502 | |||
503 | <p class="note"> | ||
504 | Note: Before the choice between IPv4 and IPv6 happens, | ||
505 | the internal socket object is invalid and therefore <a | ||
506 | href="#setoption"><tt>setoption</tt></a> will fail. | ||
507 | </p> | ||
508 | |||
509 | <!-- socket.udp4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
510 | |||
511 | <p class="name" id="socket.udp4"> | ||
512 | socket.<b>udp4()</b> | ||
513 | </p> | ||
514 | |||
515 | <p class="description"> | ||
516 | Creates and returns an unconnected IPv4 UDP object. | ||
517 | Unconnected 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>. | ||
528 | The <a href="#setpeername"><tt>setpeername</tt></a> | ||
529 | is used to connect the object. | ||
530 | </p> | ||
531 | |||
532 | <p class="return"> | ||
533 | In case of success, a new unconnected UDP object | ||
534 | returned. In case of error, <b><tt>nil</tt></b> is returned, followed by | ||
535 | an error message. | ||
536 | </p> | ||
537 | |||
538 | <!-- socket.udp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
539 | |||
540 | <p class="name" id="socket.udp6"> | ||
541 | socket.<b>udp6()</b> | ||
542 | </p> | ||
543 | |||
544 | <p class="description"> | ||
545 | Creates and returns an unconnected IPv6 UDP object. | ||
546 | Unconnected 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>. | ||
557 | The <a href="#setpeername"><tt>setpeername</tt></a> | ||
558 | is used to connect the object. | ||
559 | </p> | ||
560 | |||
561 | <p class="return"> | ||
562 | In case of success, a new unconnected UDP object | ||
563 | returned. In case of error, <b><tt>nil</tt></b> is returned, followed by | ||
564 | an error message. | ||
565 | </p> | ||
566 | |||
567 | <p class="note"> | ||
568 | Note: 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 | |||
556 | <!-- footer ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 574 | <!-- footer ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
557 | 575 | ||
558 | <div class=footer> | 576 | <div class="footer"> |
559 | <hr> | 577 | <hr> |
560 | <center> | 578 | <center> |
561 | <p class=bar> | 579 | <p class="bar"> |
562 | <a href="index.html">home</a> · | 580 | <a href="index.html">home</a> · |
563 | <a href="index.html#download">download</a> · | 581 | <a href="index.html#download">download</a> · |
564 | <a href="installation.html">installation</a> · | 582 | <a href="installation.html">installation</a> · |