Netty connection becomes inactive after 30 seconds

20 views
Skip to first unread message

centrumg...@gmail.com

unread,
Apr 16, 2018, 4:30:59 AM4/16/18
to Netty discussions

I am trying to make a netty connection for a project and I am successfully able to make it. However, after 30 seconds the connection becomes inactive. I'm purposefully not using the connection for something because it is a test connection but I want to keep it active for future tasks even after 30 seconds are over. This is my code to create the connection:

try {
        Bootstrap b = new Bootstrap();
        b.option(ChannelOption.TCP_NODELAY, true);
        b.option(ChannelOption.SO_KEEPALIVE, true);
        b.group(new NioEventLoopGroup());
        b.channel(NioSocketChannel.class);
        b.handler(new ReadTimeoutHandler(50));

        InetSocketAddress sa = new InetSocketAddress("--------IP HIDDEN--------", 25454);
        ChannelFuture f = b.connect(sa.getAddress(), sa.getPort()).sync(); // (5)
        Channel chan = f.channel();
        //Channel becomes inactive after 30 seconds
    } catch (Exception e) {
        e.printStackTrace();
    }
Reply all
Reply to author
Forward
0 new messages