Internet User Datagram Protocol
s = socket(AF_INET, SOCK_DGRAM, 0);
fd = open(_PATH_UDP, 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 IP transport level may be used with
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 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 trying to send a datagram, but no destination address
is specified, and the socket hasn't been
when the system runs out of memory for an internal data structure
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 no argument/NULL 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.
udp is conformant with:
RFC 768 (STD 6), RFC 1122 (STD 7)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003