Sequenced socket (SOCK_SEQPACKET) connection

Sequenced Packet Socket connections are connection oriented sockets. The normal socket connection APIs such as bind/listen/accept/connect are used to establish a socket connection. In all respects, as far as the connection establishment is concerned, it is equivalent to a TCP stream socket connection.

The SOCK_SEQPACKET socket connection has the below properties:

  • The TCP stream socket does not maintain socket boundaries. However, the SOCK_SEQPACKET connection preserves message boundaries similar to a UDP socket connection.
  • The communication via SOCK_SEQPACKET is reliable similar to a TCP stream connection
  • The messages are transmitted to the receiver in order and sequence of packets is maintained

Linux supports SOCK_SEQPACKET for Unix domain sockets. Certain protocols like SCTP supports Sequenced socket connection. UDP and TCP protocols do not support SOCK_SEQPACKET connection

 Reference:

  • The Linux Programming Interface – Michael Kerrisk
  • Unix Network Programming – W. Richard Stevens, Bill Fenner, Andrew M. Rudoff

Sequenced Packet Socket code example  

Comments

  1. Pingback: SocketPair Socket Connection | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *