I'm using the write() function to write to a socket in C. I am not a C expert, and sometimes I know this function can fail, in those cases it can return some kind of SIGPIPE.
Here's the simple piece of code I'm using now:
if(write(sockfd, sendline, sizeof(sendline)) < sizeof(sendline))
{
printf("Failed to write string %s to socket" , sendline);
return NULL;
}
My question is, how can I properly manage those kind of errors (SIGPIPE, etc) when using this function?