Because netty
uses different channel initialization for SCTP and TCP, so I would like to check if the platform supports SCTP, if it does, uses SCTP otherwise uses TCP. However, I could not find any method to check this in both JDK8 or netty4.
Asked
Active
Viewed 506 times
1 Answers
2
It should be possible to call com.sun.nio.sctp.SctpServerChannel
without an exception if sctp is available but I can't confirm that because I support sctp on all my devices.
To ensure that you have a correctly configured machine and JDK, try compiling and running the following application:
public class TestSCTP
{
public static void main(String[] args) throws Exception {
com.sun.nio.sctp.SctpChannel sc = com.sun.nio.sctp.SctpChannel.open();
}
}
$ jdk1.7.0/bin/javac TestSCTP.java
$ jdk1.7.0/bin/java TestSCTP
If it compiles and runs without any errors, then congratulations you have a correctly configured machine and JDK. You can now start writing applications that use the SCTP API.

Ingrim4
- 321
- 2
- 13
-
2If doing this check from a program, make sure to close the channel after a success check, else you leak 1 of your file descriptors – Ferrybig Apr 12 '18 at 17:11