SCTP, the next generation transport layer protocol !
First of all, welcome to the world of protocols !
TCP is OK but what is this SCTP ?
Simply put, a new transport layer (remember OSI model !), just like TCP but has many advantage specifically made for the telecom industry.
Key features include
1. Message framing
2. Multihoming and,
3. Multi streaming.
Now, do we really need a new transport layer protocol when people are happy using TCP as a standard and most stable protocol on the earth? Fortunately or unfortunately, YES !
Of course, we could have hacked TCP to get those features, but IETF chosen for new RFC 2960 which alone has around 150 pages. From this figure, you can imagine how complex SCTP is!
For general understanding,
We can say SCTP as
“TCP + some security features + multihoming + multistreaming + message framing + blah blah blah ”
Let us look at some drawbacks of TCP which forced us to go for NEW protocol!
1. Byte oriented: This is actually not a drawback, rather a limitation! That means, the application has to do something to find out the message boundary. Hmmm..this sentence looks bit complex.
What I mean, let us say a client-server application, client wants to send a message to sever. In server, when we call recv(), we get a stream of bytes. And, we don’t know how many bytes to read to get a complete message. Of course, somehow we can have an understanding between client and server that each message can have only so many bytes. FYI, this “somehow” is nothing but implementing message boundary in the application layer. Now, if we use SCTP, we just have to call recvmsg() and SCTP will give us the message and the length of that received message. Isn’t this a cool feature?
2. Head-of-line blocking: Yes, this is a serious problem especially in the world of telecommunication. Consider a case of sending independent messages over a TCP socket. Even though, logically the messages are independent, if any problem in any of the messages sent earlier will cause blocking of latest messages. This is because; TCP keep on retransmitting older messages. This is what we call Head-of-line blocking. This can be solved by hacking TCP to maintain a different logical streams and this what has been done in SCTP with multi-streaming feature!
3. Only ordered message delivery: TCP doesn’t care what application wants
instead, it sends all the messages in the same order as they were sent from the originating point. Really, for some application message ordering is not needed what all it needs is a reliable transfer of messages. Let us accept it, we want something like a cocktail with UDP and TCP in it ![]()
4. Multihoming : Where a host with multiple points of attachment to the Internet, for redundancy purposes. i.e. a host with multiple IP addresses. This is made for the telecom industry where a host must have an alternative reachable endpoint. Not useful for most of the applications, though.
With this much of knowledge, let us jump into SCTP.
If you have a Linux PC with Kernel 2.6.X, all you need is
Download and install socket API from lksctp.sourceforge.net , a SCTP implementation in the Linux kernel.
Best thing is to download, theese RPMs
1. lksctp-tools-1.0.4-1.i386.rpm
2. lksctp-tools-doc-1.0.4-1.i386.rpm
And use below commands to install
1. $rpm -ivh lksctp-tools-1.0.4-1.i386.rpm
2. $rpm -ivh lksctp-tools-doc-1.0.4-1.i386.rpm
Then, insert the SCTP module on a running kernel..
1. $ /sbin/modprobe SCTP , this will insert the sctp.o module in the kernel and then,
2. $ man sctp to start of with SCTP socket programming !
As you can see in the manuals, APIs are same as that for BSD sockets for TCP/UDP.
Infact the only change you need is
fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP))
Generally, we used to put “0” for the third parameter which used to tell kernel to choose appropriate protocol depending on whether SCOK_STREAM or SOCK_DGRM. But, now we explicitly tell kernel to use SCTP protocol.SOCK_SEQPACKET is for datagrams of fixed maximum length, usefull for message oriented communication between client-server.
If you don’t want to mess-up with kernel stuff, there is a sctplib waiting for you !
Which is user level SCTP library created by the University of Essen in co-operation with Siemens AG. Please go through the website and also the manual provided in the package. For the reference, you can get many demo application and sample programs in the sctplib package.
I also started following this protocol recently, anyway I can help you to clarify some of your doubts, so in case, please leave a comment HERE!
Related posts:
- Links related to SCTP links related to SCTP ...
Tags: client-server, drivers, Kernel, Linux, lksctp, mandrake, Mandriva, osi, protocols, SCTP, sctplib, socket programming, tcp, telecom, udp
This entry was posted
on Wednesday, December 21st, 2005 at 2:57 am and is filed under General, Links, c-linux.
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
January 19th, 2006 at 1:24 pm
I wanted to do a project using SCTP, I was also looking in to SCTP available on http://openss7.org have you gone through this. For my mini project I think libsctp is sufficient.