Rejecting connections on open with a ServerSocketChannel

Iain McGinniss iainmcgin at gmail.com
Mon Jul 27 07:50:08 EDT 2009


Thanks Frederic, this is the approach I've taken for now. I notice  
there isn't like what I want on the normal NIO API either, so perhaps  
this is an unreasonable request :)

Iain

On 27 Jul 2009, at 12:19, Frederic Bregier wrote:

>
> Hi Iain,
>
> I'm not sure but I think there is no option to open a server socket
> without beeing able to accept new connections at the bind step in  
> Netty.
> But you can add in the pipeline a handler at first position by default
> for all new connections that will do the trick (refusing any new
> connection).
> When the server is ready to listen, you then just have to remove this
> handler
> from the pipeline.
>
> HTH,
> Frederic
>
>
> Iain McGinniss wrote:
>>
>> Hello all,
>>
>> I have a situation in my code where I want to open a server socket
>> channel in order to claim the port, but I do not yet want to accept
>> any connections on this channel as the rest of the environment isn't
>> ready yet. Is there a way to stop the server channel from accepting
>> connections (and, preferrably, forcefully reject them), or is my only
>> option to close the connection as soon as I'm aware of it, i.e.
>> reacting to a ChildChannelStateEvent and calling close on the  
>> channel?
>>
>> Iain
>>
>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>>
>
>
> -----
> Hardware/Software Architect
> -- 
> View this message in context: http://n2.nabble.com/Rejecting-connections-on-open-with-a-ServerSocketChannel-tp3333195p3333257.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users



More information about the netty-users mailing list