Connection-Oriented Flow

When a UDP socket is created, its local and remote addresses are unspecified. Datagrams can be sent immediately using sendto() or sendmsg() system calls with a valid destination address as an argument

When connect() is called on the socket, the default destination address is set and datagrams can now be sent using send() or write() without specifying a destination address. It is still possible to send to other destinations by passing an address to sendto() or sendmsg()

The connect() system call connects the socket to the specified address. If the socket is of type SOCK_DGRAM, then the specified address is the address to which datagrams are sent by default, and the only address from which datagrams are received

References