mariusmmg2
mariusmmg2

Reputation: 723

Boost::ASIO: Bidirectional communication using two processes

I want to make two applications (two linux processes) with the following behavior:

This would be easy if i'd used threads (I would only share the asio tcp::socket object), but I can't use threads for some reason.

How can I achieve this with two different applications? (without some forms of IPC).

Upvotes: 1

Views: 449

Answers (1)

Tamás Szelei
Tamás Szelei

Reputation: 23961

You don't even need two processes, you can post your async_writes and async_reads to the same message loop and they will get processed. Not strictly in parallel, of course, but if your environment restricts the use of threads (why?), this is the easiest option (especially if want to also not use any IPC). To be fair, the I/O happens in parallel to the program execution, but your completion handlers will not be called in parallel, unless more threads are executing the loop.

Upvotes: 1

Related Questions