Reputation: 1319
I am working on a Mac OS application and using BSD Socket. I have several TCP sockets during run-time.
When SIGPIPE comes, what I know is that one or some socket(s) is/are closed by remote server. Is it possible to determine which socket(s) goes/go wrong when I catch the SIGPIPE signal?
Upvotes: 0
Views: 242
Reputation: 54325
If your program is single threaded it is the last file descriptor that you wrote to. If multithreaded then you are out of luck.
I recommend that in both cases you just set SIGPIPE to SIGIGN and use the return value of write to determine a closed file descriptor.
Upvotes: 1