0

when using netty to programe, I occur an question : "control maximum number of established connections" Is there such a method can implements this featrue?

just like : "serverBootstrap.option( ChannelOption.SO_BACKLOG,100);" which is used to set the maximum muber of un-accepted queue connections.

1 Answers1

0

You have write such a feature by yourself. For example, you could count the number of active conections in your handler and close any additionally incoming connections if the number of active connections exceeds the limit or simply stop accepting anything.

trustin
  • 12,231
  • 6
  • 42
  • 52
  • thank you very much, as I am not familiar with stackoverflow, delay two days to reponse. do you mean this : counter.addAndGet( 1 ) in channelActive( ChannelHandlerContext ctx ) ounter.decrementAndGet() in channelInactive( ChannelHandlerContext ctx ) and netty4.0 does not surport directorly like "serverBootstrap.option( ChannelOption.SO_BACKLOG,100);" – timeriver.wang Apr 01 '13 at 11:39