f



How to use multithread handler recognition in handleInput

Hello=20



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 simultaneous=
ly.



I have extended the WFMO_Reactor_Logging_Server in the C++ Network Programm=
ing, 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 implement=
ing state machine to be able to offer a service in multithread.

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

=20


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


The mainstream is configured with a MainI class that when connection arrive=
s
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 hand=
ler that gets handleinput called are not always s=E9parate between two conn=
ections and data input on the network by one peer is perturbating the recep=
tion 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 multithrea=
d 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

ricoo








0
ricoo
3/14/2016 7:12:23 PM
comp.soft-sys.ace 20326 articles. 1 followers. marlow.andrew (167) is leader. Post Follow

0 Replies
701 Views

Similar Articles

[PageSpeed] 57

Reply: