Can I use pipe between two process without using fork and share file descriptors with for example socket ? I don't need another solution, I need pipe between two process that not forked.
Syntax: fork(); // It does not take any parameter, it returns // integer values. It may return negative, // positive or zero integer values. pipe(): It is used for inter-process communication in Linux. It is a system function. (
pipe() is a Linux system function. The pipe() system function is used to open file descriptors, which are used to communicate between different Linux processes. In short, the pipe() function is used for inter-process communication in Linux.
An unnamed pipe is a direct connection between two commands running in the same terminal. If we want to send output from a command in one terminal to another command in a different terminal, we can use a named pipe, or FIFO. FIFO stands for first in, first out. This is a pipe that exists in the file system.
A pipe is a form of redirection (transfer of standard output to some other destination) that is used in Linux and other Unix-like operating systems to send the output of one command/program/process to another command/program/process for further processing.
You could use a named pipe (FIFO):
if you do mkfifo <common path>
, you an use this path in both processes, one for reading and one for writing. Then you have the same behaviour as with a normal pipe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With