• How to use multithread handler recognition in handleInput

    From ricoo@21:1/5 to All on Mon Mar 14 12:12:23 2016

    My app runs well with reactor (not WFMO) but can only serve one client at a time, (when acceptor handle input is called more than once i discard). My challenge is to change my app to support more than one client simultaneously.

    I have extended the WFMO_Reactor_Logging_Server in the C++ Network Programming, Volume 2 book but I face a problem.

    I have tryed using the ACE_WFMO_Reactor with a Mainstream class.

    This Mainstream contains an ACE_STREAM, containing 3 ACE_MODULE (network, other, user), each composed of 2 ACE_TASKs (recv and sender), and implementing state machine to be able to offer a service in multithread.

    The process when one peer connects involve many data exchange in both directions (to achieve a complete file transfer protocol implementation, but not an commonly known FTP, something more complex).

    In static ACE_THR_FUNC_RETURN event_loop function,
    1) I pass the reactor to the Netwok module recv task, and inialize a LoggingHandler passing super class ACE_Event_Handler the parameter reactor from thead args
    2) In initialise the Mainstream class with construct the stream, passing the tasks ...
    3) I call cnxAcceptor_->activeAcceptorHandler passing the argument this Netwok module LoggingHandler .
    4) I start my Mainstream method start method

    The mainstream is configured with a MainI class that when connection arrives send data (ready message) , and then collects messages from network and so on with interactions.

    The problem is that when 2 people connect on the same time, thead and handler that gets handleinput called are not always sÚparate between two connections and data input on the network by one peer is perturbating the reception and the state machine of
    the other peer with unpredictable behaviour.

    My question is .
    Is is design flaw of my use of ACE_WFMO_Reactor or is it because ACE_WFMO_Reactor is not suited for porting a mono thread state machine to multithread to provide more service (when one peer is connected it can last long and the server is not available)?

    In case ACE_WFMO_Reactor is not right, could you indicate me which example should I inspire myself of ?

    Best Regards


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)