[ace-users] ACE_NonBlocking_Connect_Handler examples?

Nicole Neo nicolen at gmail.com
Tue May 19 04:35:04 CDT 2015


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

http://www.dre.vanderbilt.edu/Doxygen/6.1.0/html/libace-doc/a00423.html

    ACE_Connector<TCPPort, ACE_SOCK_CONNECTOR> connectortcp;
    ACE_NonBlocking_Connect_Handler<TCPPort> nbHandler =
ACE_NonBlocking_Connect_Handler<TCPPort>(connectortcp, this, 123);
    nbHandler.reactor(ACE_Reactor::instance());

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/d0abda95/attachment.html>


More information about the ace-users mailing list