]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/udp.7
epoll.7: wfix
[thirdparty/man-pages.git] / man7 / udp.7
CommitLineData
77117f4f 1.\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
2297bf0e 2.\"
00acdba1 3.\" %%%LICENSE_START(VERBATIM_ONE_PARA)
77117f4f
MK
4.\" Permission is granted to distribute possibly modified copies
5.\" of this page provided the header is included verbatim,
6.\" and in case of nontrivial modification author and date
7.\" of the modification is added to the header.
8ff7380d 8.\" %%%LICENSE_END
6a717e5e 9.\"
77117f4f
MK
10.\" $Id: udp.7,v 1.7 2000/01/22 01:55:05 freitag Exp $
11.\"
9ba01802 12.TH UDP 7 2019-03-06 "Linux" "Linux Programmer's Manual"
77117f4f
MK
13.SH NAME
14udp \- User Datagram Protocol for IPv4
15.SH SYNOPSIS
16.B #include <sys/socket.h>
17.br
18.B #include <netinet/in.h>
47bf54b2
BP
19.br
20.B #include <netinet/udp.h>
68e4db0a 21.PP
d4c8c97c 22.B udp_socket = socket(AF_INET, SOCK_DGRAM, 0);
77117f4f
MK
23.SH DESCRIPTION
24This is an implementation of the User Datagram Protocol
25described in RFC\ 768.
26It implements a connectionless, unreliable datagram packet service.
27Packets may be reordered or duplicated before they arrive.
28UDP generates and checks checksums to catch transmission errors.
5711c04f 29.PP
77117f4f
MK
30When a UDP socket is created,
31its local and remote addresses are unspecified.
32Datagrams can be sent immediately using
33.BR sendto (2)
34or
35.BR sendmsg (2)
36with a valid destination address as an argument.
37When
38.BR connect (2)
fe10db36 39is called on the socket, the default destination address is set and
77117f4f
MK
40datagrams can now be sent using
41.BR send (2)
42or
43.BR write (2)
44without specifying a destination address.
45It is still possible to send to other destinations by passing an
46address to
47.BR sendto (2)
48or
49.BR sendmsg (2).
fe10db36 50In order to receive packets, the socket can be bound to a local
77117f4f
MK
51address first by using
52.BR bind (2).
2b9b829d 53Otherwise, the socket layer will automatically assign
77117f4f 54a free local port out of the range defined by