Boost.Process
http://www.highscore.de/cpp/process/
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
> [...]I have seen this documentation before. It says that two processes
> have to be
> related.
Rohini,
you can download the latest draft of Boost.Process from
http://www.highscore.de/boost/gsoc2010/process.zip. This version provides
stream behaviors to configure streams of a child process. Among others a
stream behavior for named pipes is provided. You could use it like this:
named_pipe np("/tmp/mypipe");
stream_ends ends = np(input_stream);
... = ends.child.native();
... = ends.parent.native();
The parameter passed to named_pipe::operator()() tells the stream behavior
if the child handle should be configured for input or output. stream_ends
is basically a std:pair<handle, handle> without requiring developers to
remember what the child and the parent handle is. And the method
handle::native() (and handle::release()) can be used to get the file
descriptor on Unix and the HANDLE on Windows.
HTH,
Boris
> [...]
> [...]Now, I want to use some other IPC technique other than boost
> message queues
> due to the above reason. So I thought of checking if pipe communication
> is
> possible between two unrelated processes using boost.
>
> Could you please help me if you have more information regarding this.
I think the fastest solution for you is to copy&paste the code from the
stream behavior named_pipe in Boost.Process. One process needs to call
mkfifo() and open() and the other process only open(). If you set the
O_NONBLOCK flag with fcntl() you can even use asynchronous I/O with
Boost.Asio (see boost::asio::posix::stream_descriptor). It's not a Boost
solution but copying and adapting the code shouldn't take longer than a
few minutes. :)