|
|
1.1 root 1: .\" Copyright (c) 1983 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)udp.4p 6.2 (Berkeley) 5/16/86
6: .\"
7: .TH UDP 4P "May 16, 1986"
8: .UC 5
9: .SH NAME
10: udp \- Internet User Datagram Protocol
11: .SH SYNOPSIS
12: .B #include <sys/socket.h>
13: .br
14: .B #include <netinet/in.h>
15: .PP
16: .B s = socket(AF_INET, SOCK_DGRAM, 0);
17: .SH DESCRIPTION
18: UDP is a simple, unreliable datagram protocol which is used
19: to support the SOCK_DGRAM abstraction for the Internet
20: protocol family. UDP sockets are connectionless, and are
21: normally used with the
22: .I sendto
23: and
24: .IR recvfrom
25: calls, though the
26: .IR connect (2)
27: call may also be used to fix the destination for future
28: packets (in which case the
29: .IR recv (2)
30: or
31: .IR read (2)
32: and
33: .IR send (2)
34: or
35: .IR write(2)
36: system calls may be used).
37: .PP
38: UDP address formats are identical to those used by
39: TCP. In particular UDP provides a port identifier in addition
40: to the normal Internet address format. Note that the UDP port
41: space is separate from the TCP port space (i.e. a UDP port
42: may not be \*(lqconnected\*(rq to a TCP port). In addition broadcast
43: packets may be sent (assuming the underlying network supports
44: this) by using a reserved \*(lqbroadcast address\*(rq; this address
45: is network interface dependent.
46: .PP
47: Options at the IP transport level may be used with UDP; see
48: .IR ip (4P).
49: .SH DIAGNOSTICS
50: A socket operation may fail with one of the following errors returned:
51: .TP 15
52: [EISCONN]
53: when trying to establish a connection on a socket which
54: already has one, or when trying to send a datagram with the destination
55: address specified and the socket is already connected;
56: .TP 15
57: [ENOTCONN]
58: when trying to send a datagram, but
59: no destination address is specified, and the socket hasn't been
60: connected;
61: .TP 15
62: [ENOBUFS]
63: when the system runs out of memory for
64: an internal data structure;
65: .TP 15
66: [EADDRINUSE]
67: when an attempt
68: is made to create a socket with a port which has already been
69: allocated;
70: .TP 15
71: [EADDRNOTAVAIL]
72: when an attempt is made to create a
73: socket with a network address for which no network interface
74: exists.
75: .SH SEE ALSO
76: getsockopt(2), recv(2), send(2), socket(2), intro(4N), inet(4F), ip(4P)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.