From ee34b7a68d00fce26ff98e1af88a95b4b5c4ef3a Mon Sep 17 00:00:00 2001 From: May Keable Date: Tue, 7 Aug 2018 15:07:47 +0100 Subject: [PATCH] Disabling SIGPIPE errors on UDP Client. --- Sources/yudpsocket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/yudpsocket.c b/Sources/yudpsocket.c index f7700de..e59a725 100644 --- a/Sources/yudpsocket.c +++ b/Sources/yudpsocket.c @@ -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; }