I am trying to use SO_NOSIGPIPE in a tcp socket.
int set = 1;
setsockopt(sockDesc, SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int);
but an error is coming:
error: SO_NOSIGPIPE was not declared in this scope
Is there any header files required, to use that. I have searched over the Internet but didn't get any useful solution.
There is no SO_NOSIGPIPE
in Linux (nor some other systems). You can instead use the MSG_NOSIGNAL
flag when calling send()
, or use signal(SIGPIPE, SIG_IGN)
to make your entire application ignore SIGPIPE
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With