Home » Android » network programming – SCTP protocol support in android

network programming – SCTP protocol support in android

Posted by: admin June 15, 2020 Leave a comment


How can I use SCTP protocol in Android?

I’m already aware that that Android systems don’t support SCTP by default, however it’s may be possible to enable it by inserting SCTP kernel module, or rebuilding the kernel with SCTP enabled in modules configuration.

I need some insight on this issue. Is it possible? How to make android support the protocol? How to build kernel module and insert it correctly? If we could succeed in making the system to support it, how we can use the protocol? Does the Java API on android support SCTP?

How to&Answers:

Going about it with a module is the right way. To answer your questions:

  • SCTP is already provided as a kernel module in the Linux source tree – “CONFIG_IP_SCTP=m” would enable that module. And you can change that to a “y” to hard link, though that is probably unfeasible, since you’d have to rebuild the entire kernel for that.

  • The module would have to still be built per kernel version. So basically per vendor, you’d need to get their kernel sources (doable), and then compile your module against it.

To use: In User mode – would create the socket by calling s = socket (AF_INET[6], SOCK_STREAM, IPPROTO_SCTP); From that point, socket APIs work exactly the same, with a few exceptions (namely setsockopt, which is particular for the protocol type).

From Java – does in fact support the protocol in its latest incarnations (JDK7 as of milestone 3), but that Java supports it doesn’t mean that Dalvik (the “java vm” of Android) does. Though Android does have SCTP support “in the ready”, it’s not yet in Dalvik (at least not in 4.2). You could create a Java class, though, as in a package, that would wrap a native library with SCTP calls. It’s a bit trickier in Android because of the NET permissions, but still manageable (from experience).