Internet User Datagram Protocol
s = socket(AF_INET, SOCK_DGRAM, 0);
s = socket(AF_INET6, SOCK_DGRAM, 0);
fd = open(_PATH_UDP, flags);
fd = open(_PATH_UDPIPV6, flags);
UDP is a simple, unreliable datagram protocol
that is used to support the SOCK_DGRAM
abstraction for the Internet protocol family.
UDP sockets are connectionless, and are normally
used with the sendto and recvfrom
call may also be used to fix the destination for future
packets (in which case the
system/library calls may be used). In addition,
UDP is available as TLI connectionless
transport via the special file /dev/inet/udp.
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 (that is, a UDP
port may not be ``connected'' to a TCP
port). In addition, broadcast packets may be sent
(assuming the underlying network supports this) by using a
reserved ``broadcast address''; this address is
network interface dependent.
Options at the IPv4 transport level may be used with
UDP if AF_INET is specified; see
Options at the IPv6 transport level may be used with
UDP if AF_INET6 is specified; see
The UDP driver may also be accessed by opening it
directly. Network related statistics can be obtained by
issuing the following ioctls, defined in
<netinet/udp_var.h>, to the driver:
to set the inpcb associated with the end-point as
a management inpcb (to distinguish it from
others, when network statistics are gathered) and link it
in the list of management inpcbs.
to extract UDP statistics. The structure
udpstat is passed as an argument to the
I_STR ioctl call.
to fetch the entire UDP table. It is a
transparent ioctl and functions similar to
A socket operation may fail with one of the following errors returned:
An ioctl operation may fail with the
errno set to one of the following:
when an attempt is made to create a socket with a port which has
already been allocated
when an attempt is made to create a socket with a network address
for which no network interface exists.
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
when the system runs out of memory for an internal data structure
when the system runs out of STREAMS
when trying to send a datagram, but no destination address
is specified, and the socket has not been connected
when no more UDP devices are available
when an invalid argument is passed to the
driver, or when the command in the copyresp
structure is not valid, or when the
not TRANSPARENT for a transparent ioctl
when the associated file descriptor is no longer open/valid.
``User Datagram Protocol (UDP) parameters''
RFC 768, RFC 1122
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004