Sockets come in two basic types—connection-oriented and connectionless. These terms refer to types of protocols. Beginners sometimes get confused with the term connectionless. Of course, two systems communicating over a network are in some sense connected. Keep in mind that these terms are used with special meanings, which we will cover shortly, and should not imply that some protocols manage to send data without a connection.
The two protocols that are used today are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). TCP is a connection-oriented protocol, and UDP is a connectionless protocol.
The socket APIs also support other less-common or outdated protocols, which we do not cover in this book.
In a connectionless protocol, such as UDP, each data packet is addressed individually. From the protocol's perspective,...