I have 2 processes talking to each other Sender and Receiver via socket.I would like to catch signal Control-C and instead of exiting – display some output.Sender and Receiver are working fine,so I added signal(SIGINT,handler) to Sender’s body. handler() just outputs some text.So when I run them and hit Cnt-C – signal gets caught and handler outputs the text but exits the Sender process.Sender has a loop that listens for user input unless Cnt-D – so why handler is making Sender exit?
Share
If you are not re-registering the signal inside the handler, then it will revert to the default value, and exit once a signal has been sent the second time. For more detailed explanation look at my post here.