In addition to the connection-oriented communications described in the previous section, connectionless communication via the UDP protocol is also supported in the AF_INET and AF_INET6 domains.
Connectionless communications are executed via datagram sockets (SOCK_DGRAM). In contrast to connection-oriented tasks, where the client and server communicate with each other via a fixed connection, no connection is set up for datagram transfers. Each message contains the destination address instead.
In the section "Creating a socket", you will find a description of how datagram sockets are created. If a specific local address is required, the bind() function must be called before the first data transfer (see section "Assigning a name to a socket"). Otherwise, the system assigns the local Internet address and/or port number the first time data is sent (see section "Assigning addresses with wildcards (AF_INET, AF_INET6)").