[Ace-users] [ace-users] how to implement nonblocking reconnect using connector-acceptor pattern ?
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Thu Oct 18 21:25:25 CDT 2007
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
More information about the Ace-users
mailing list