Remove advertising header from man pages.
[dragonfly.git] / share / man / man4 / udp.4
1 .\" Copyright (c) 1983, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)udp.4       8.1 (Berkeley) 6/5/93
29 .\" $FreeBSD: src/share/man/man4/udp.4,v 1.8.2.4 2001/12/17 11:30:12 ru Exp $
30 .\" $DragonFly: src/share/man/man4/udp.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
31 .\"
32 .Dd June 5, 1993
33 .Dt UDP 4
34 .Os
35 .Sh NAME
36 .Nm udp
37 .Nd Internet User Datagram Protocol
38 .Sh SYNOPSIS
39 .In sys/types.h
40 .In sys/socket.h
41 .In netinet/in.h
42 .Ft int
43 .Fn socket AF_INET SOCK_DGRAM 0
44 .Sh DESCRIPTION
45 .Tn UDP
46 is a simple, unreliable datagram protocol which is used
47 to support the
48 .Dv SOCK_DGRAM
49 abstraction for the Internet
50 protocol family.
51 .Tn UDP
52 sockets are connectionless, and are
53 normally used with the
54 .Xr sendto 2
55 and
56 .Xr recvfrom 2
57 calls, though the
58 .Xr connect 2
59 call may also be used to fix the destination for future
60 packets (in which case the
61 .Xr recv 2
62 or
63 .Xr read 2
64 and
65 .Xr send 2
66 or
67 .Xr write 2
68 system calls may be used).
69 .Pp
70 .Tn UDP
71 address formats are identical to those used by
72 .Tn TCP .
73 In particular
74 .Tn UDP
75 provides a port identifier in addition
76 to the normal Internet address format.  Note that the
77 .Tn UDP
78 port
79 space is separate from the
80 .Tn TCP
81 port space (i.e. a
82 .Tn UDP
83 port
84 may not be
85 .Dq connected
86 to a
87 .Tn TCP
88 port).  In addition broadcast
89 packets may be sent (assuming the underlying network supports
90 this) by using a reserved
91 .Dq broadcast address ;
92 this address
93 is network interface dependent.
94 .Pp
95 Options at the
96 .Tn IP
97 transport level may be used with
98 .Tn UDP ;
99 see
100 .Xr ip 4 .
101 .Sh ERRORS
102 A socket operation may fail with one of the following errors returned:
103 .Bl -tag -width Er
104 .It Bq Er EISCONN
105 when trying to establish a connection on a socket which
106 already has one, or when trying to send a datagram with the destination
107 address specified and the socket is already connected;
108 .It Bq Er ENOTCONN
109 when trying to send a datagram, but
110 no destination address is specified, and the socket hasn't been
111 connected;
112 .It Bq Er ENOBUFS
113 when the system runs out of memory for
114 an internal data structure;
115 .It Bq Er EADDRINUSE
116 when an attempt
117 is made to create a socket with a port which has already been
118 allocated;
119 .It Bq Er EADDRNOTAVAIL
120 when an attempt is made to create a
121 socket with a network address for which no network interface
122 exists.
123 .El
124 .Sh MIB VARIABLES
125 The
126 .Nm
127 protocol implements a number of variables in the
128 .Li net.inet
129 branch of the
130 .Xr sysctl 3
131 MIB.
132 .Bl -tag -width UDPCTL_RECVSPACEX
133 .It UDPCTL_CHECKSUM
134 .Pq udp.checksum
135 Enable udp checksums (enabled by default).
136 .It UDPCTL_MAXDGRAM
137 .Pq udp.maxdgram
138 Maximum outgoing UDP datagram size
139 .It UDPCTL_RECVSPACE
140 .Pq udp.recvspace
141 Maximum space for incoming UDP datagrams
142 .It udp.log_in_vain
143 For all udp datagrams, to ports on which there is no socket
144 listening, log the connection attempt (disabled by default).
145 .It udp.blackhole
146 When a datagram is received on a port where there is no socket
147 listening, do not return an ICMP port unreachable message.
148 (Disabled by default.  See
149 .Xr blackhole 4 . )
150 .El
151 .Sh SEE ALSO
152 .Xr getsockopt 2 ,
153 .Xr recv 2 ,
154 .Xr send 2 ,
155 .Xr socket 2 ,
156 .Xr blackhole 4 ,
157 .Xr inet 4 ,
158 .Xr intro 4 ,
159 .Xr ip 4
160 .Sh HISTORY
161 The
162 .Nm
163 protocol appeared in
164 .Bx 4.2 .