I am debugging a c based linux socket program. As all the examples available in websites, I applied the following structure:
sockfd= socket(AF_INET, SOCK_STR
Check the return value, and see if it's equal to this value:
EPIPE
This socket was connected but the connection is now broken. In this case, send generates a SIGPIPE signal first; if that signal is ignored or blocked, or if its handler returns, then send fails with EPIPE.
Also add a check for the SIGPIPE signal in your handler, to make it be more controllable.