]>
Commit | Line | Data |
---|---|---|
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 | .\" | |
4c1c5274 | 12 | .TH udp 7 (date) "Linux man-pages (unreleased)" |
77117f4f MK |
13 | .SH NAME |
14 | udp \- User Datagram Protocol for IPv4 | |
15 | .SH SYNOPSIS | |
c7db92b9 | 16 | .nf |
77117f4f | 17 | .B #include <sys/socket.h> |
77117f4f | 18 | .B #include <netinet/in.h> |
47bf54b2 | 19 | .B #include <netinet/udp.h> |
68e4db0a | 20 | .PP |
72f41c04 | 21 | .IB udp_socket " = socket(AF_INET, SOCK_DGRAM, 0);" |
c7db92b9 | 22 | .fi |
77117f4f MK |
23 | .SH DESCRIPTION |
24 | This is an implementation of the User Datagram Protocol | |
25 | described in RFC\ 768. | |
26 | It implements a connectionless, unreliable datagram packet service. | |
27 | Packets may be reordered or duplicated before they arrive. | |
28 | UDP generates and checks checksums to catch transmission errors. | |
5711c04f | 29 | .PP |
77117f4f MK |
30 | When a UDP socket is created, |
31 | its local and remote addresses are unspecified. | |
32 | Datagrams can be sent immediately using | |
33 | .BR sendto (2) | |
34 | or | |
35 | .BR sendmsg (2) | |
36 | with a valid destination address as an argument. | |
37 | When | |
38 | .BR connect (2) | |
fe10db36 | 39 | is called on the socket, the default destination address is set and |
77117f4f MK |
40 | datagrams can now be sent using |
41 | .BR send (2) | |
42 | or | |
43 | .BR write (2) | |
44 | without specifying a destination address. | |
45 | It is still possible to send to other destinations by passing an | |
46 | address to | |
47 | .BR sendto (2) | |
48 | or | |
49 | .BR sendmsg (2). | |
fe10db36 | 50 | In order to receive packets, the socket can be bound to a local |
77117f4f MK |
51 | address first by using |
52 | .BR bind (2). | |
2b9b829d | 53 | Otherwise, the socket layer will automatically assign |
77117f4f | 54 | a free local port out of the range defined by |