tags:

views:

178

answers:

0

There is a client (user) who wants to interact with Process B. For security purposes, Process A is between client and Process B. Users can only access Process A. Process A is a relay. It reads from the client (user) and sends data without modification to Process B. It also reads from Process B and sends data to the user without modification:

Client (User) <--> Process A <--> Process B

Process A and Process B use socket reactors as specified in EchoServer example: ~/poco-1.3.5/Net/samples/EchoServer/src/EchoServer.cpp. For the user, process A is the server. I use socket reactors to handle communication from the user just like EchoServer. Similarly, for process A, process B is the server. Process B uses socket reactors for communicating.

For Process B, Process A is the client. When there is some data on the socket for Process B, an event is triggered and the corresponding event handler onReadable() is called (just like EchoServer). I want to get a similar mechanism for the client socket: When there is something on the socket for Process A from Process B, is it possible to trigger an event and call an event handler? Of course, there is no need to spawn a new thread in Process A for communicating with Process B.

Thanks for your time.