All rights reserved.
%sccs.include.redist.man%
@(#)udp.4 6.4 (Berkeley) 06/23/90
s = socket(AF_INET, SOCK_DGRAM, 0);
UDP address formats are identical to those used by TCP. In particular UDP provides a port identifier in addition to the normal Internet address format. Note that the UDP port space is separate from the TCP port space (i.e. a UDP port may not be \*(lqconnected\*(rq to a TCP port). In addition broadcast packets may be sent (assuming the underlying network supports this) by using a reserved \*(lqbroadcast address\*(rq; this address is network interface dependent.
Options at the IP transport level may be used with UDP; see ip (4).
15 [EISCONN] when trying to establish a connection on a socket which already has one, or when trying to send a datagram with the destination address specified and the socket is already connected;
15 [ENOTCONN] when trying to send a datagram, but no destination address is specified, and the socket hasn't been connected;
15 [ENOBUFS] when the system runs out of memory for an internal data structure;
15 [EADDRINUSE] when an attempt is made to create a socket with a port which has already been allocated;
15 [EADDRNOTAVAIL] when an attempt is made to create a socket with a network address for which no network interface exists.