Re: [fpc-pascal] Re: How to handle SIGPIPE

2012-03-20 Thread michael . vancanneyt



On Tue, 20 Mar 2012, Tobias Giesen wrote:


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 $2 and I'm
hoping for the best ...

I also added this to my program, is that correct?


At first sight: yes.

Michael.



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


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: How to handle SIGPIPE

2012-03-20 Thread Jonas Maebe


On 20 Mar 2012, at 08:41, Tobias Giesen wrote:

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 $2 and I'm
hoping for the best ...


Hoping is not enough when changing random values. See http://bugs.freepascal.org/view.php?id=9401 
 for more info.



Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: How to handle SIGPIPE

2012-03-20 Thread Tobias Giesen
 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


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal