A socket consists of a set of application programming interfaces (APIs) working between the transport layer and application layer. The socket shields differences of transport layer protocols and provides the uniform programming interfaces for the application layer. In this manner, the application layer, being exempt from the detailed process of the TCP/IP protocol suite, can transmit data over IP networks by calling socket functions. Figure 1 shows the position of the socket in the TCP/IP protocol stack.
The following types of sockets are supported by different protocols at the transport layer:
TCP-based socket: provides reliable byte-stream communication services for the application layer.
UDP-based socket: supports connectionless and unreliable data transmission for the application layer and preserves datagram boundaries.
RawIP socket: also called raw socket. Similar to the UDP-based socket, the RawIP socket supports connectionless and unreliable data transmission and preserves datagram boundaries. The RawIP socket is unique in that it can be used by applications to directly access the network layer.
Link layer-based socket: used by Intermediate System to Intermediate System (IS-IS) to directly access the link layer.