Starting acceptors in "paused" state

Skip to first unread message

Tim Fox

Dec 1, 2020, 11:30:16 AM12/1/20
to Netty discussions
Hey Norman,

Second question of the day!

I'm porting an existing server to Netty. I have a requirement where I need to have server sockets bound but not in a state where they will accept connections, i.e. without the OP_ACCEPT registered. AUI, clients that attempt to connect during that time will not fail but will be queued until the server is ready to accept connections.

Then some time later I want to say "hey now you can start accepting connections", and then register the OP_ACCEPT. Looking at NioServerSocket it seems currently to always start with OP_ACCEPT.

Any thoughts on how I can achieve this behaviour with Netty?

Norman Maurer

Dec 1, 2020, 11:37:47 AM12/1/20
Yep … Thats easy to do.

Just use:

ServerBootstrap bs = new ServerBootstrap();
sb.option(ChannelOption.AUTO_READ, false) ….

And once you want to start accepting use

Channel.config().setAutoRead(true); or channel.config().setOption(ChannelOption.AUTO_READ, true);.

You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Reply all
Reply to author
0 new messages