[Ace-users] [ace-users] how to implement nonblocking reconnect using connector-acceptor pattern ?
Mihai Bucica
misu200 at yahoo.com
Fri Oct 19 03:09:32 CDT 2007
I'm using ACE_Connector::connect() with USE_REACTOR
and a timeout parameter. In handle_timeout I restart
the connection.
Also If connection drops I set up a timer ( for 0 or
more seconds) in handle_close() and the connect
sequence will eventually be started again in
handle_timeout()
--- "Douglas C. Schmidt" <schmidt at dre.vanderbilt.edu>
wrote:
> Hi,
>
> Please see
>
> ACE_ROOT/examples/Connection/non_blocking
>
> for examples of non-blocking connects.
>
> Doug
>
> >ACE version 5.6.1
> >Host windows xp sp2
> >Compiler ms visual studio 2003
> >
> >In my app, I use ACE_Connector and an existing
> ACE_Svc_Handler object
> >to connect to the server. First, I call
> ACE_Connector::connect() with
> >USE_REACTOR options. If the server is not open or a
> connection is
> >dropped, handle_close is called.
> >
> >Can I write reconnect logic in handle_close like
> the following:
> >int CMyHandler::handle_close(ACE_HANDLE handle,
> ACE_Reactor_Mask mask)
> >{
> > this->peer().close();
> > ACE_Time_Value to(5);
> > ACE_Synch_Options
> options(ACE_Synch_Options::USE_REACTOR, to);
> >
> > if(Connect_(this, server_addr_, options) == -1 &&
> >ACE_OS::last_error() != EWOULDBLOCK)
> > return -1;
> >
> > return 0;
> >}
> >
> >My question is:
> >What's the normal implement logic of nonblocking
> reconnection ?
> >Is there any nonblocking reconnection example? In
> Chap 7 of C++NPv2,
> >there is only plain texts about that, but not in
> detail.
> >
> >thanks!
> >
>
>
> --
> Dr. Douglas C. Schmidt
> Professor and Associate Chair
> Electrical Engineering and Computer Science TEL:
> (615) 343-8197
> Vanderbilt University WEB:
> www.dre.vanderbilt.edu/~schmidt
> Nashville, TN 37203 NET:
> d.schmidt at vanderbilt.edu
>
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Ace-users
mailing list