Hello,
my app does http transfers using the Synapse library on Windows and Mac OS X. The transfers happen in separate threads. On Mac OS X only, the app is occasionally stopped due to a SIGPIPE.
How can I avoid or handle a SIGPIPE?
Cheers,
Tobias

Mailing lists / fpc-pascal / 2012-03
5 messages · 3 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello,
my app does http transfers using the Synapse library on Windows and Mac OS X. The transfers happen in separate threads. On Mac OS X only, the app is occasionally stopped due to a SIGPIPE.
How can I avoid or handle a SIGPIPE?
Cheers,
Tobias
Hi,
I think the biggest issue is that MSG_NOSIGNAL is not defined on MAC OS, even though it was added a few years (?) ago. When I ported Synapse, unfortunately I defined it as 0. Now I changed that to $20000 and I'm hoping for the best ...
I also added this to my program, is that correct?
var NewSigRecSigActionRec;
res:Integer;
initialization
with NewSigRec do begin
Integer(@Sa_Handler):=SIG_IGN; // ignore signal
Sa_Mask[0]:=0;
Sa_Flags:=0;
end;
res:=fpsigaction(SIGPIPE,@NewSigRec,@OldSigRec);Cheers,
Tobias
At first sight: yes.
Michael.
I think the biggest issue is that MSG_NOSIGNAL is not defined on MAC OS, even though it…
Hoping is not enough when changing random values. See http://bugs.freepascal.org/view.php?id=9401 for more info.
Jonas
Hoping is not enough when changing random values. See http://bugs.freepascal.org/view.php?id=9401 for more info.
Wow. Many thanks!
I read that MSG_NOSIGNAL is now supported by MacOS, too, but I don't really know.
So now I am calling fpsetsockopt with SO_NOSIGPIPE as the first thing after every fpSocket call. That should probably do it, right?
The bug comments on the above URL are not totally clear because you cannot actually pass any options to the Connect call. So I assume you should use fpsetsockopt before the Connect call.
Cheers,
Tobias