|
|
Datagram sockets can also use connect to associate a socket with a specific address. Any data sent on the socket is automatically addressed to the connected peer, and only data received from that peer is delivered to the user.
Connect requests on datagram sockets return immediately; the system merely records the peer's address, as compared to a stream socket where a connect request initiates establishment of an end to end connection. The accept and listen calls are not used with datagram sockets.
If connect is used with a datagram socket, read, write, send and recv can be used to transfer data.