From: Gennady Date: 2004-06-18T01:26:11+09:00 Subject: Re: Bidirectional named pipes on Linux On Jun 16, 2004, at 22:48, Scott Rubin wrote: > Phil Tomson wrote: >> I've got two programs which need to communicate (which eliminates >> un-named pipes). Information needs to be sent in both directions >> such that one program (say it's called the master) sends a couple of >> bytes to and then waits for a response from the other program (say >> it's called the slave) and so on. It looks like if you open the pipe >> (or FIFO file) from both sides in read/write mode that the pipe is >> opened non-blocking so what ends up happening is that the side which >> sends first just keeps sending and doesn't wait for a response. >> ...yeah, I should probably be using sockets, but this is a sort of >> 'legacy' system. >> phil > > Phil, > > I'm doing this exact same thing on a linux system so that a ruby > process and a C process can communicate. It works perfectly, here is > generally how I did it. First, pipes are one way. You can have one > end reading and one end writing at the same time, but both sides may > not write simultaneously and both ends may not read simultaneously. > Pipes are strictly fifos, that's why the command to make named ones is > mkfifo. One way in, one way out. So you can Actually, the original command for making fifos (as well as other types of special files) is mknod (it is in /etc on some systems, in /bin or /sbin on others): mknod p ;-) Sincerely, Gennady Bystritsky