David Schwartz wrote:
> On Jul 16, 9:12 am, Bjorn Nuyttens <cyberc...@pandora.be> wrote:
>
>> When the server is in the middle of a send() or write() call, the
>> process exists with error code 141. No Segmentation faults, no
>> exceptions thrown, not even a return value from the send/write call. I
>> expect send or write to return -1 (see manpages) but it does not return,
>> the whole process just exits.
>>
>> Any ideas what could be causing this? Can this be caused by a bug in the
>> OS (Ubuntu 7.04)?
>
> No, the OS is doing the right thing. Since your program can no longer
> write to the place it was trying to write, the OS assumes that it can
> no longer make useful progress. You didn't tell the OS anything else,
> so you get the default behavior.
>
> Google for 'SIGPIPE'.
>
> DS
>
For those interested: you could either ignore or handle the SIGPIPE
signal or specifiy the MSG_NOSIGNAL option with the send command. For
the time being, I chose the latter.
printf("1"); fflush(stdout);
int retval = send(s, pData, uLength, MSG_NOSIGNAL);
printf("2"); fflush(stdout);
Thanks to David for pointing me in the right direction!
|