I developing an Java application which have SCTP connection. My application is acting as client and server based on user configurations. The SCTP connection and data transaction working fine. But the user want to have configurable SCTP HEARTBEAT. I tried to send via SctpChannel and create new SctpMessage, but this can use for send the SCTP DATA Chunk only, where in my case the HEARTBEAT is in it own chunk. Is there any configuration to change the interval? or is it possible that i create my own heartbeat data and send it in current connection?
Here my code:
SCTPClientHandler2 sctpClientHandler = new SCTPClientHandler2();
setBootstrap(new Bootstrap()
.group(loopGroup)
.channel(NioSctpChannel.class)
.option(SctpChannelOption.SCTP_NODELAY, true)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
.option(ChannelOption.SO_KEEPALIVE, true)
.handler(new ChannelInitializer<SctpChannel>() {
@Override
public void initChannel(SctpChannel ch) {
ChannelPipeline p = ch.pipeline();
logger.info("Channel initialize: {}", this);
p.addLast(sctpClientHandler);
logger.info("p.addLast(sctpClientHandler)");
// ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
// executorService.scheduleAtFixedRate(() -> {
// }, 0, 2000, TimeUnit.MILLISECONDS);
}
}));
Bootstrap instanceBootStrap = (Bootstrap) getBootstrap();
ChannelFuture f = instanceBootStrap.connect(
new InetSocketAddress(this.remoteHost.getIpAddr(),
this.remoteHost.getPort()),
new InetSocketAddress(this.localHost.getIpAddr(),
this.localHost.getPort())
).sync();
f.channel().closeFuture().sync();
I have some the following:
- Find in the netty documentations if any SCTP heartbeat interval configuration that i can set, but not found.
- Try by create my own SCTP heartbeat and send it to the SctpChannel, but i can create a message for SCTP DATA Chunk only, where i expect the output is HEARTBEAT chunk.