When using a raw TCP socket, there is a need for doing message framing, as explained here, either with a length prefix, or with delimiters.
I came accross the "SOCK_SEQPACKET" socket option today, which could apparently do the message framing almost transparently.
What is the availability of "SOCK_SEQPACKET" amongst platforms and OSes at the moment? (Windows, OSX, Linux, IOS, Android...)
In the UNIX domain, the SOCK_STREAM socket type works like a pipe. In the Internet domain, the SOCK_STREAM socket type is implemented on the Transmission Control Protocol/Internet Protocol (TCP/IP) protocol.
Seqpacket. 5. Provides connection-oriented and reliable two-way transfer of ordered byte streams across a network. Seqpacket does not duplicate data, and it preserves boundaries within the data stream.
Sequenced Packet Sockets (SPS)It allows the user to modify the SP Protocols header on a packet or a group of packets, either by writing a prototype header along whatever data is to be sent or by specifying a default header to be used with all outgoing data.
Network sockets need support from an underlying protocol such as TCP (Transmission Control Protocol) or the lower-level UDP (User Datagram Protocol). By contrast, IPC sockets rely upon the local system kernel to support communication; in particular, IPC sockets communicate using a local file as a socket address.
I you uses SOCK_SEQPACKET
of AF_INET
, this way:
socket(AF_INET, SOCK_SEQPACKET, 0);
You won't get a TCP socket. The socket will be a SCTP socket, if your platform supports it.
SCTP is not yet widely used. Latest Linux versions supports it (if SCTP is enabled).
There are some libraries also for Windows.
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