I just started learning about sockets programming, and I've run into a concept I've seen before but was quite confusing to me.
It seems that UDP connections are "connectionless, unconnected" connections.
Isn't "connectionless" and "unconnected" redundant?
Are there then 4 types of connections?
i.e.
And finally, how can a "connectionless, unconnected" connection function? Isn't that an oxymoron? lol
Technically, you can call connect()
on a UDP socket. In this case the socket remembers the peer address, so that datagrams can be send using send()
or write()
syscalls instead of sendto()
. Also, it makes the socket receive datagrams only from that peer, datagrams from other peers get discarded.
May be this is what is referred to as "connectionless, connected" socket, meaning connect()
call was invoked on a UDP socket.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With