UDP(3X) UDP(3X) NAME udp_connect, udp_listen, udp_datagram - udp networking functions SYNOPSIS #include <sys/inet/udp_user.h> int udp_connect(sport, dhost, dport) in_addr dhost; udp_port sport, dport; int udp_listen(sport, reply) udp_port sport; struct udpreply *reply; int udp_datagram(sport) udp_port sport; DESCRIPTION These routines are loaded by the -lin option of ld(1). UDP (universal datagram protocol) is a protocol layered upon IP (internet protocol). It provides datagram service between end points called sockets. A socket address is com- posed of the internet address of its host and the port num- ber to which the socket is bound. Udp_connect returns the file descriptor of a UDP socket bound to port sport. Each read(2) from this file descriptor will only accept datagrams from the UDP socket at host dhost, port dport; a write on this file descriptor will be sent to that socket. Udp_listen returns the file descriptor of a UDP socket bound to port sport and waits for a datagram to be sent to that port. Once a message has been received from another socket, all writes will go to that socket and reads will only accept data from that socket. Udp_datagram returns the file descriptor of a UDP socket bound to port sport. Messages written to the file descriptor must start with a struct udpaddr which contains the destina- tion of the message. struct udpaddr { in_addr host; int port; }; Messages read from the file descriptor also start with a UDP(3X) UDP(3X) struct udpaddr and contain the address of the source socket. FILES the socket devices SEE ALSO internet(3), tcp(3) DIAGNOSTICS All these routines returns -1 on failure.