Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOCK_SEQPACKET availability?

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...)

like image 674
plang Avatar asked Nov 08 '12 10:11

plang


People also ask

Where is Sock_stream defined?

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.

What is Seqpacket?

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.

What Sequenced Packet sockets?

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.

How is socket implemented in Linux?

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.


1 Answers

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.

like image 162
SKi Avatar answered Sep 20 '22 05:09

SKi