Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/udp_proto.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/udp_proto.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/udp_proto.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/udp_proto.html on line 8
Internet User Datagram Protocol
#include <sys/socket.h>
#include <netinet/in.h>
int socket( AF_INET,
SOCK_DGRAM,
0 );
UDP is a simple, unreliable datagram protocol that's 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()
calls, although you can also use the
connect()
call
to fix the destination for future packets (in which case you
can use the
recv()
or
read()
and
send()
or
write()
system calls).
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.
You can use options at the IP transport level with UDP (see
the IP protocol).
A descriptor referencing the socket, or -1 if an error occurs
(errno is set).
- EADDRINUSE
- You tried to create a socket with a port that has already
been allocated.
- EADDRNOTAVAIL
- You tried to create a socket with a network address for
which no network interface exists.
- EISCONN
- You tried to establish a connection on a socket that already
has one, or to send a datagram with the destination
address specified and the socket is already connected.
- ENOBUFS
- The system ran out of memory for an internal data structure.
- ENOTCONN
- You tried to send a datagram, but no destination address was
specified and the socket hasn't been connected.
IP protocol
connect(),
getsockopt(),
read(),
recv(),
recvfrom(),
send(),
sendto(),
socket(),
write()
Based on RFC 768
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/udp_proto.html on line 163
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/udp_proto.html on line 163