[Ace-users] [ace-users] Configure number of connections ACE_Acceptor willaccept
Steve Huston
shuston at riverace.com
Thu Feb 28 13:46:05 CST 2008
Hi Mitch,
> >Let me apologize in advance for my ignorance. I'm an old socket
guy.
>
> No problemo - that's where I started too!
>
> >I am using ACE_Acceptor and would like to configure the number of
> >accepts (1..n) the Acceptor will allow.
Unfortunately, there's no way to set the backlog level for
ACE_Acceptor as there is for ACE_SOCK_Acceptor.
> >Basically, if nConnections = 1, the ACE_Acceptor will create one
> >SvcHandler and any more connection requests should result in
> >'connection refused' by the requesting peer. If the connected peer
> >closes the connection, the next connection request will be
accepted.
> >
> >Using the following, all connection requests are accepted
> and multiple
> >SvcHandlers are instantiated.
>
> There are various ways you could do this. One easy one would be to
> subclass from ACE_Acceptor and override the make_svc_handler()
method
> to keep track of the number of active connections and only create a
> new SvcHandler if the number of active connections is below
> nConnections_. Naturally, you'd need to define some sort of
callback
> method in your ACE_Aceptor subclass that your SvcHandler will call
> when a connection is closed so that the nConnection_ count is
> maintained properly.
Right... You also may be able to employ ACE_Oneshot_Acceptor here
since it only does one acceptance at a time.
Best regards,
-Steve
More information about the Ace-users
mailing list