Friday, February 15, 2008

IPC: interprocess communication

A pipe is used for one-way communication of a stream of bytes.

Creating a pipe:

int pfd[2];
pipe(pfd);

These two file descriptors can be used for block I/O.

write(pfd[1], buf, size);
read(pfd[0], buf, size);

A pipe opened before the fork becomes shared between the two processes.



Reference:
http://people.cis.ksu.edu/~singh/CIS725/Fall99/programs/sock_ipc_tut.html

No comments: