Disabling SIGPIPE errors on UDP Client.

This commit is contained in:
May Keable 2018-08-07 15:07:47 +01:00
parent 7cd6d8e846
commit ee34b7a68d

View File

@ -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;
}