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