[CentOS] socket: write vs send

Tue Apr 6 20:37:06 UTC 2010
Les Mikesell <lesmikesell at gmail.com>

On 4/6/2010 3:19 PM, Michael D. Berger wrote:
> On Tue, 06 Apr 2010 14:53:45 -0500, Les Mikesell wrote:
>
> [...]
>
>>
>> They should be equivalent - if the other end closes first, you'll get a
>> SIGPIPE, which by default will kill the process.  If you want to keep
>> running you have to handle or ignore the signal.
>
> How about if I use MSG_NOSIGNAL in the flags argument?

If you are writing something that is supposed to be a long-running 
server process you should explicitly ignore all the signals that you 
don't want to kill it, and have handlers for anything that might be 
useful.  For example SIGHUP is often used to tell a program to re-read 
its configuration file.  Since the source code for the whole system is 
available you should be able to find examples.  Or look at the *bsd 
versions if you are concerned about accidentally duplicating some GPL'd 
code.

-- 
   Les Mikesell
    lesmikesell at gmail.com