Skip to content

Commit

Permalink
Merge pull request #150 from keab42/bugfix/fix-sigpipe-13-error
Browse files Browse the repository at this point in the history
Disabling SIGPIPE errors on UDP Client.
  • Loading branch information
pengyunchou committed Jul 24, 2019
2 parents 7cd6d8e + ee34b7a commit cb0af50
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/yudpsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ int yudpsocket_client() {
int socketfd = socket(AF_INET, SOCK_DGRAM, 0);
int reuseon = 1;
setsockopt(socketfd, SOL_SOCKET, SO_REUSEADDR, &reuseon, sizeof(reuseon));

//disable SIGPIPE as we'll handle send errors ourselves
int noSigPipe = 1;
setsockopt(socketfd, SOL_SOCKET, SO_NOSIGPIPE, &noSigPipe, sizeof(noSigPipe));

return socketfd;
}
Expand Down

0 comments on commit cb0af50

Please sign in to comment.