|
|
1.1 ! root 1: .\" Copyright (c) 1983 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" Redistribution and use in source and binary forms are permitted provided ! 5: .\" that: (1) source distributions retain this entire copyright notice and ! 6: .\" comment, and (2) distributions including binaries display the following ! 7: .\" acknowledgement: ``This product includes software developed by the ! 8: .\" University of California, Berkeley and its contributors'' in the ! 9: .\" documentation or other materials provided with the distribution and in ! 10: .\" all advertising materials mentioning features or use of this software. ! 11: .\" Neither the name of the University nor the names of its contributors may ! 12: .\" be used to endorse or promote products derived from this software without ! 13: .\" specific prior written permission. ! 14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 17: .\" ! 18: .\" @(#)udp.4 6.4 (Berkeley) 6/23/90 ! 19: .\" ! 20: .TH UDP 4 "June 23, 1990" ! 21: .UC 5 ! 22: .SH NAME ! 23: udp \- Internet User Datagram Protocol ! 24: .SH SYNOPSIS ! 25: .B #include <sys/socket.h> ! 26: .br ! 27: .B #include <netinet/in.h> ! 28: .PP ! 29: .B s = socket(AF_INET, SOCK_DGRAM, 0); ! 30: .SH DESCRIPTION ! 31: UDP is a simple, unreliable datagram protocol which is used ! 32: to support the SOCK_DGRAM abstraction for the Internet ! 33: protocol family. UDP sockets are connectionless, and are ! 34: normally used with the ! 35: .I sendto ! 36: and ! 37: .IR recvfrom ! 38: calls, though the ! 39: .IR connect (2) ! 40: call may also be used to fix the destination for future ! 41: packets (in which case the ! 42: .IR recv (2) ! 43: or ! 44: .IR read (2) ! 45: and ! 46: .IR send (2) ! 47: or ! 48: .IR write(2) ! 49: system calls may be used). ! 50: .PP ! 51: UDP address formats are identical to those used by ! 52: TCP. In particular UDP provides a port identifier in addition ! 53: to the normal Internet address format. Note that the UDP port ! 54: space is separate from the TCP port space (i.e. a UDP port ! 55: may not be \*(lqconnected\*(rq to a TCP port). In addition broadcast ! 56: packets may be sent (assuming the underlying network supports ! 57: this) by using a reserved \*(lqbroadcast address\*(rq; this address ! 58: is network interface dependent. ! 59: .PP ! 60: Options at the IP transport level may be used with UDP; see ! 61: .IR ip (4). ! 62: .SH DIAGNOSTICS ! 63: A socket operation may fail with one of the following errors returned: ! 64: .TP 15 ! 65: [EISCONN] ! 66: when trying to establish a connection on a socket which ! 67: already has one, or when trying to send a datagram with the destination ! 68: address specified and the socket is already connected; ! 69: .TP 15 ! 70: [ENOTCONN] ! 71: when trying to send a datagram, but ! 72: no destination address is specified, and the socket hasn't been ! 73: connected; ! 74: .TP 15 ! 75: [ENOBUFS] ! 76: when the system runs out of memory for ! 77: an internal data structure; ! 78: .TP 15 ! 79: [EADDRINUSE] ! 80: when an attempt ! 81: is made to create a socket with a port which has already been ! 82: allocated; ! 83: .TP 15 ! 84: [EADDRNOTAVAIL] ! 85: when an attempt is made to create a ! 86: socket with a network address for which no network interface ! 87: exists. ! 88: .SH SEE ALSO ! 89: getsockopt(2), recv(2), send(2), socket(2), intro(4), inet(4), ip(4)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.