0

PIPES are unidirectional and can be synchronous or asynchronous in communication.

But how to create a Bidirectional Named pipe with one endpoint on one process and the other endpoint on other process both processes sharing the same memory and is present within the same operating system and communicating asynchronously.

Is there a way to do it ?

7
  • struct { int read_pipe_fd, write_pipe_fd; } bidirectional;
    – CL.
    Commented Mar 27, 2015 at 8:33
  • Thanks. But the message passing should be on a single bidirectional channel with an endpoint connected to one process and the other endpoint connected to the 2nd process. In the structure above , it will be treated as a two different channels that are acting bidirectional. I'm confused, Please correct me.
    – Angus
    Commented Mar 27, 2015 at 8:42
  • You'd have two unidirectional pipes. What difference does it make that read() and write() are called on different fd's?
    – CL.
    Commented Mar 27, 2015 at 8:48
  • They are not being bidirectional on the same channel.. We create two different channels and one we use it for reading and the other for writing .
    – Angus
    Commented Mar 27, 2015 at 8:51
  • 1
    @Angus "They are not being bidirectional on the same channel." -- You should study the hardware analogy. Two unidirectional (aka half-duplex) channels are typically used for two-way communication. When a single channel is used for both directions, then either (a) only one end can transmit at a time with some kind of protocol to inhibit simultaneous transmission from both ends, or (b) elaborate electronics are added to each end (e.g. echo cancellation) so that each end can transmit & receive simultaneously.
    – sawdust
    Commented Mar 27, 2015 at 18:41

1 Answer 1

7

On Linux you must use two pipes if you want full duplex communication. Solaris however has full duplex pipes.

It sounds like a Unix-domain socket would satisfy your requirements. Such a socket is named, full duplex and asynchronous.

Not the answer you're looking for? Browse other questions tagged or ask your own question.