Thursday, 7 November 2013

C Program to handle SIGPIPE signal


When SIGPIPE signal is generated?
Two processes can communicate through pipe. Among these two one is the sending process and other is the receiving process. The sending and receiving processes can communicate through pipe as long as long as both processes are running at a time. The SIGPIPE signal is issued to the sending process when receiving process is terminated.

Here are C programs which will create Sending and Receiving processes.

writer.c(sending process)
https://docs.google.com/file/d/0B-V2GHdE2XghdWtuTzhQemI0R2M/edit?usp=drive_web

reader.c(receiving process)
https://docs.google.com/file/d/0B-V2GHdE2XghQzlMa0pfa2FxSkE/edit?usp=drive_web

compile and run these two programs in two different terminals in UNIX/LINUX environment.

To receive SIGPIPE signal by the sending process, terminate the receiving process with ctl+c or ctl+z. 

No comments:

Post a Comment