summaryrefslogtreecommitdiff
path: root/static/netbsd/man4/udp.4 4.html
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 19:55:15 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 19:55:15 -0400
commit253e67c8b3a72b3a4757fdbc5845297628db0a4a (patch)
treeadf53b66087aa30dfbf8bf391a1dadb044c3bf4d /static/netbsd/man4/udp.4 4.html
parenta9157ce950dfe2fc30795d43b9d79b9d1bffc48b (diff)
docs: Added All NetBSD Manuals
Diffstat (limited to 'static/netbsd/man4/udp.4 4.html')
-rw-r--r--static/netbsd/man4/udp.4 4.html112
1 files changed, 112 insertions, 0 deletions
diff --git a/static/netbsd/man4/udp.4 4.html b/static/netbsd/man4/udp.4 4.html
new file mode 100644
index 00000000..71e6b56a
--- /dev/null
+++ b/static/netbsd/man4/udp.4 4.html
@@ -0,0 +1,112 @@
+<table class="head">
+ <tr>
+ <td class="head-ltitle">UDP(4)</td>
+ <td class="head-vol">Device Drivers Manual</td>
+ <td class="head-rtitle">UDP(4)</td>
+ </tr>
+</table>
+<div class="manual-text">
+<section class="Sh">
+<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
+<p class="Pp"><code class="Nm">udp</code> &#x2014; <span class="Nd">Internet
+ User Datagram Protocol</span></p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
+<p class="Pp"><code class="In">#include
+ &lt;<a class="In">sys/socket.h</a>&gt;</code>
+ <br/>
+ <code class="In">#include &lt;<a class="In">netinet/in.h</a>&gt;</code></p>
+<p class="Pp"><var class="Ft">int</var>
+ <br/>
+ <code class="Fn">socket</code>(<var class="Fa" style="white-space: nowrap;">AF_INET</var>,
+ <var class="Fa" style="white-space: nowrap;">SOCK_DGRAM</var>,
+ <var class="Fa" style="white-space: nowrap;">0</var>);</p>
+<p class="Pp"><var class="Ft">int</var>
+ <br/>
+ <code class="Fn">socket</code>(<var class="Fa" style="white-space: nowrap;">AF_INET6</var>,
+ <var class="Fa" style="white-space: nowrap;">SOCK_DGRAM</var>,
+ <var class="Fa" style="white-space: nowrap;">0</var>);</p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
+<p class="Pp">UDP is a simple, unreliable datagram protocol which is used to
+ support the <code class="Dv">SOCK_DGRAM</code> abstraction for the Internet
+ protocol family. UDP sockets are connectionless, and are normally used with
+ the <a class="Xr">sendto(2)</a> and <a class="Xr">recvfrom(2)</a> calls,
+ though the <a class="Xr">connect(2)</a> call may also be used to fix the
+ destination for future packets (in which case the <a class="Xr">recv(2)</a>
+ or <a class="Xr">read(2)</a> and <a class="Xr">send(2)</a> or
+ <a class="Xr">write(2)</a> system calls may be used).</p>
+<p class="Pp">UDP address formats are identical to those used by TCP. In
+ particular UDP provides a port identifier in addition to the normal Internet
+ address format. Note that the UDP port space is separate from the TCP port
+ space (i.e. a UDP port may not be &#x201C;connected&#x201D; to a TCP port).
+ In addition broadcast packets may be sent (assuming the underlying network
+ supports this) by using a reserved &#x201C;broadcast address&#x201D;; this
+ address is network interface dependent.</p>
+<p class="Pp">There are two UDP-level
+ <a class="Xr">setsockopt(2)</a>/<a class="Xr">getsockopt(2)</a> options.
+ <code class="Dv">UDP_OPTIONS</code> may be used to change the default
+ behavior of the socket. For example:</p>
+<div class="Bd Pp Li">
+<pre>setsockopt(s, IPPROTO_UDP, UDP_OPTIONS, NULL, 0);</pre>
+</div>
+<p class="Pp">The <code class="Dv">UDP_ENCAP</code> option can be used to
+ encapsulate ESP packets in UDP. There is one valid encapsulation option:
+ UDP_ENCAP_ESPINUDP from RFC3948 defined in
+ <code class="In">&lt;<a class="In">netinet/udp.h</a>&gt;</code>.</p>
+<p class="Pp">Options at the IP transport level may be used with UDP; see
+ <a class="Xr">ip(4)</a> or <a class="Xr">ip6(4)</a>.</p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="DIAGNOSTICS"><a class="permalink" href="#DIAGNOSTICS">DIAGNOSTICS</a></h1>
+<p class="Pp">A socket operation may fail with one of the following errors
+ returned:</p>
+<dl class="Bl-tag">
+ <dt>[<code class="Er">EADDRINUSE</code>]</dt>
+ <dd>when an attempt is made to create a socket with a port which has already
+ been allocated;</dd>
+ <dt>[<code class="Er">EADDRNOTAVAIL</code>]</dt>
+ <dd>when an attempt is made to create a socket with a network address for
+ which no network interface exists.</dd>
+ <dt>[<code class="Er">EISCONN</code>]</dt>
+ <dd>when trying to establish a connection on a socket which already has one,
+ or when trying to send a datagram with the destination address specified
+ and the socket is already connected;</dd>
+ <dt>[<code class="Er">ENOBUFS</code>]</dt>
+ <dd>when the system runs out of memory for an internal data structure;</dd>
+ <dt>[<code class="Er">ENOTCONN</code>]</dt>
+ <dd>when trying to send a datagram, but no destination address is specified,
+ and the socket hasn't been connected;</dd>
+</dl>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
+ ALSO</a></h1>
+<p class="Pp"><a class="Xr">getsockopt(2)</a>, <a class="Xr">recv(2)</a>,
+ <a class="Xr">send(2)</a>, <a class="Xr">socket(2)</a>,
+ <a class="Xr">inet(4)</a>, <a class="Xr">inet6(4)</a>,
+ <a class="Xr">intro(4)</a>, <a class="Xr">ip(4)</a>,
+ <a class="Xr">ip6(4)</a>, <a class="Xr">rfc6056(7)</a>,
+ <a class="Xr">sysctl(7)</a></p>
+<p class="Pp"><cite class="Rs"><span class="RsT">User Datagram Protocol</span>,
+ <span class="RsR">RFC</span>, <span class="RsN">768</span>,
+ <span class="RsD">August 28, 1980</span>.</cite></p>
+<p class="Pp"><cite class="Rs"><span class="RsT">Requirements for Internet Hosts
+ &#x2014; Communication Layers</span>, <span class="RsR">RFC</span>,
+ <span class="RsN">1122</span>, <span class="RsD">October
+ 1989</span>.</cite></p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
+<p class="Pp">The <code class="Nm">udp</code> protocol appeared in
+ <span class="Ux">4.2BSD</span>.</p>
+</section>
+</div>
+<table class="foot">
+ <tr>
+ <td class="foot-date">May 31, 2018</td>
+ <td class="foot-os">NetBSD 10.1</td>
+ </tr>
+</table>