Re: broken pipe
Re: broken pipe
- Subject: Re: broken pipe
- From: Rakesh Singhal <email@hidden>
- Date: Thu, 19 Feb 2009 10:08:20 +0530
Thanks M and Shawn. I have already handler for SIGPIPE in which it is
doing nothing, just ignoring. When I get SIGPIPE, I am not getting any
error in write() call, does it mean my app is getting SIGPIPE due to
some other thing?
Shawn, I do not have any socket() in my app. I am communicating to
serial port through read() and write(), after setting some parameters.
Regards
rksinghal
On Thu, Feb 19, 2009 at 5:23 AM, Shawn Erickson <email@hidden> wrote:
>>> On Feb 17, 2009, at 2:06 PM, Rakesh Singhal wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am getting SIGPIPE (broken pipe) signal. I have implemented signal
>>>> handler.
>>>>
>>>> I do not know, why I am getting it in my app. I do not have any
>>>> sockets in my app. I am communicating with serial port and my own
>>>> dynamic libraries. How can I find the cause of this signal? Please
>>>> suggest.
>>>
>>> You are writing to descriptor which has nothing on the other side (reading).
>>> You should ignore the SIGPIPE signal on all threads and check for
>>> errno==EPIPE instead.
>
> To get EPIPE you need set socket to return such a value instead of
> fire a SIGPIPE.
>
> "SO_NOSIGPIPE is an option that prevents SIGPIPE from being raised
> when a write fails on a socket to which there is no reader; instead,
> the write to the socket returns with the error EPIPE when there is no
> reader."
>
> int sigPipe = 1;
> ::setsockopt(_fd, SOL_SOCKET, SO_NOSIGPIPE, (const char*)&sigPipe,
> sizeof(sigPipe));
>
> Anyway how are you talking with the serial port?
>
> -Shawn
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden