Hi,
How can i catch sigpipe in iphone/objective-c?
thanks
Hi,
How can i catch sigpipe in iphone/objective-c?
thanks
Use old good POSIX code:
#include <signal.h>
void SigPipeHandler(int s);
void SigPipeHandler(int s)
{
// do your handling
}
Init in some place (main.m?) with
signal(SIGPIPE, SigPipeHandler);
Try setting SO_NOSIGPIPE as documented here: http://stackoverflow.com/questions/108183/how-to-prevent-sigpipes-or-handle-them-properly
The first answer doesn't work. Also I'm trying to use solution described in reference of second post:
int main(int argc, char *argv[ ]) {
struct sigaction mySigAction;
mySigAction.sa_handler = SIG_IGN;
sigemptyset(&mySigAction.sa_mask);
sigaction(SIGPIPE, &mySigAction, NULL);
...
}
but this code doesn't work too. Anybody know solution of this problem?