Reputation: 2617
In socket ssize_t send(int __fd, const void* __buf, size_t __n, int __flags)
we got this __flags
argument. I'm using MSG_NOSIGNAL
flag all through the connection. Is there a way to achieve this flag functionality in write
? Since I'm using this flag all through the connection, It could be set when socket
is created. Feel free to mention If there are ways to achieve all the __flag
functions.
Upvotes: 27
Views: 43493
Reputation: 409166
No. When writing to a socket with write
it's the same thing as calling send
with the flags
argument set to zero.
From the official POSIX reference
If fildes refers to a socket, write() shall be equivalent to send() with no flags set.
There is however a way of "setting" this flag permanently, and that is to ignore the SIGPIPE
signal:
signal(SIGPIPE, SIG_IGN);
Upvotes: 44