Re: broken pipe
Re: broken pipe
- Subject: Re: broken pipe
- From: Shawn Erickson <email@hidden>
- Date: Wed, 18 Feb 2009 15:53:55 -0800
>> 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