[ace-users] ACE_NonBlocking_Connect_Handler examples?

Steve Huston shuston at riverace.com
Tue May 19 07:48:34 CDT 2015

Hi Nicole,

The ACE_NonBlocking_Connect_Handler is generally used internally to ACE. ACE_Connector uses it internally when you want non-blocking behavior on the connect. You shouldn’t need to use it in the case you show below.

Please see $ACE_ROOT/tests/Conn_Test.cpp and $ACE_ROOT/examples/APG/Reactor/Client.cpp (goes with APG chapter 7 discussion) for examples of using ACE_Connector.


From: ace-users [mailto:ace-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Nicole Neo
Sent: Tuesday, May 19, 2015 5:35 AM
To: ace-users at list.isis.vanderbilt.edu
Subject: [ace-users] ACE_NonBlocking_Connect_Handler examples?

Has anyone managed to use ACE_NonBlocking_Connect_Handler successfully? I have abandoned the combined Priority + Thread pool Reactor approqached (see my previous post) in favour for this but it's very lacking in documentation and examples.

I have written a new ConnectHandler class that implements handle_input(), handle_output() and handle_exception().

I can't manage to link my Connector SVC_Handler implementation with ACE_NonBlocking_Connect_Handler


    ACE_Connector<TCPPort, ACE_SOCK_CONNECTOR> connectortcp;
    ACE_NonBlocking_Connect_Handler<TCPPort> nbHandler = ACE_NonBlocking_Connect_Handler<TCPPort>(connectortcp, this, 123);

connectortcp.open(ACE_Reactor::instance(), ACE_NONBLOCK);
        int connFailure = connectortcp.connect(port, addr, ACE_Synch_Options(ACE_Synch_Options::USE_REACTOR, port->connTimeout));
The connect() does return -1 and errno = EWOULDBLOCK as expected cos the connect is done in a separate thread and the ACE_NON_Blocking_Connect_Handler should be called by the Reactor.

I can see from TCP dump that it has managed to connect successfully but it doesn't seem to do the connect in a separate thread and call the handle_input() method of ACE_NonBlocking_Connect_Handler. Neither does it attempt to retry connecting if I start the server after the first connect attempt has failed.

The regular blocking connect (done in the same thread) that was implemented before works correctly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/cgi-bin/mailman/private/ace-users/attachments/20150519/db1b6307/attachment.html>

More information about the ace-users mailing list