How to communicate between two processes after you fork()? IPC mechanisms exist to communicate between related and unrelated processes.
Common methods are simple file I/O or even signals which just trigger. Perhaps you can trigger a file read after you write to it with a signal. But I don't do such things. I don't send signals between processes. Other methods are shared memory and UNIX domain sockets. I use both. Shared memory is bit boring. UNIX domain sockets can easily be welded into the poll(2) system call that I normally use anyway. So I ended up using that instead. The other common method is using pipe(2). I have used pipe but not much. It is unidirectional. Sometimes that is sufficient. And pipe can work with fork() processes. Only. UNIX domain sockets are cool since they are very generic and the semantics for communicating across the Internet and UNIX domain sockets are exactly identical. And you can even communicate with unrelated daemons that way. In fact I have had to do quite a bit of advanced operations particularly using web CGI. They all use UNIX domain sockets. I find the data transfer, EOF tracking, size that can be transferred, bidirectional facility, speed everything very satisfactory. I found some easy samples for you to try when I Googled. You could also do what I did. ;) Socket communications are a very nice topic to learn. -Girish -- Gayatri Hitech http://gayatri-hitech.com _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
