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