Dravenj
Dravenj

Reputation: 71

Is there a way to indicate to Netty after a Bind occurs to timeout within a period of time if no client connects

If I bind to a specific address/port is there a way to force it to unbind if no client has connected within a period of time and is there a way to be notified by a listener if there is an option?

Upvotes: 0

Views: 108

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23567

There is nothing like this build in. That said you can do this by yourself. Just add a ChannelInboundHandlerAdapter to the childHandler method that overrides channelActive(...). Then schedule a timer that will check if this method was called within time X and if not close the Channel.

Upvotes: 1

Related Questions