Hi Maarten,

are you using this solution to limit connection? I tried it, but I can not
manage situation where the client close unexpectedly che connection.
The socket is in TIME_WAIT status and mina obtain an exception
"java.net.BindException: Address already in use" when try to bind.

nicola.


Maarten Bosteels-4 wrote:
> 
> On 2/14/07, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
>>
>> I'm not a MINA expert, but I guess you also have to add:
>> socketAcceptorConfig.setBacklog(1);
>> otherwise if multiple connections are made before you are able to really
>> accept the socket and unbind you will accept multiple connections.
> 
> 
> I agree. Thanks for pointing that out.
> 
> 
> Stefano
>>
>> Maarten Bosteels ha scritto:
>> > If you want just one connection in total, you could do
>> >
>> > public void sessionCreated(IoSession session) throws Exception {
>> >  acceptor.setDisconnectOnUnbind(false);
>> >  acceptor.unbind();
>> > }
>> >
>> > public void sessionClosed(IoSession session) throws Exception {
>> >  acceptor.bind();
>> > }
>> >
>> > Then your server would only be listening when there is no connection
>> > established.
>> > (you probably need a heartbeat mechanism to ensure that the one and
>> only
>> > connection is still alive)
>> >
>> > Maarten
>>
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-do-I-limit-a-MINA-server-to-accept-just-one-connection--tf3224401.html#a10302356
Sent from the mina dev mailing list archive at Nabble.com.

Reply via email to