man(1) Manual page archive


     UDP(3)                                                     UDP(3)

     NAME
          udp_connect, udp_listen, udp_datagram - udp operations

     SYNOPSIS
          #include <sys/inet/udp_user.h>

          udp_connect(sport, dhost, dport)
          in_addr dhost;
          udp_port sport, dport;

          udp_listen(sport, reply)
          udp_port sport;
          struct udpreply *reply;

          udp_datagram(sport)
          udp_port sport;

     DESCRIPTION
          These routines are loaded by the -lin option of ld(1).

          UDP is one of the many protocols which are layered upon IP
          (internet protocol).  It provides datagram service between
          end points called sockets.  A socket address is composed of
          the internet address of its host and the port number to
          which the socket is bound.

          Udp_connect returns the fd of a UDP socket bound to port
          sport. All writes(2) performed on this fd will be sent to
          the UDP socket at host dhost, port dport and reads(2) from
          this fd will only accept datagrams from that socket.
          Udp_connect returns -1 on failure.

          Udp_listen returns the fd 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(2) will go to that socket and reads(2) will only
          accept data from that socket.

          Udp_datagram returns the fd of a UDP socket bound to port
          sport. All messages written to the socket must start with a
          struct udpaddr which contains the destination of the mes-
          sage.
          struct udpaddr {    /* from udp_user.h */
               in_addr   host;
               int port;
          };
          All messages read from the socket also start with a struct
          udpaddr and contain the address of the source socket.

     FILES

     UDP(3)                                                     UDP(3)

          /dev/udp* the socket devices

     SEE ALSO
          internet(3), tcp(3)