Question

Maybe I'm misunderstanding How to make a pipe in c++ thus http://linux.die.net/man/2/pipe, but how does the pipe know where to send to or receive from?

Upon a database update via an ajax page, I want that ajax program to send a message to my websocket program to update all of the other relevant users, and it's been recommended that using pipe would probably be best how 2 c++ programs call each other's class/functions on same linux box?.

Is there just one pipe and all programs read it and validate the message?


Note: I'm using fastcgi++ and websocket++ if that helps.

Was it helpful?

Solution

If you want multiple independent processes to read from the pipe, you need to use a named pipe, also known as a FIFO.

Using the mkfifo function, one process creates a file in the file system (normally in /tmp). This file can then be opened for reading or writing using the normal open system call by any other process that have access to that file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top