Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-27-2010, 08:28 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 1
iruirc is on a distinguished road
Default Ignore SIGPIPE signal

My application trying to connect to server and receive signal SIGPIPE. How can i catch this signal?
I found two solutioin for this problem, but either doesn't work.

First solution is:
Code:
void SigPipeHandler(int s);

int main(int argc, char *argv[]) {
    signal(SIGPIPE, SigPipeHandler);
    ...
}

void SigPipeHandler(int s){
    NSLog(@"SigPipeHandler");
}
In second solution I'm trying to ignore SIGPIPE signal as follow:
Code:
int main(int argc, char *argv[]) {
	struct sigaction mySigAction;
	mySigAction.sa_handler = SIG_IGN;
	sigemptyset(&mySigAction.sa_mask);
        sigaction(SIGPIPE, &mySigAction, NULL);
        ...
}
but signal isn't ignored. I'm also trying to handle signal to set handler:
Code:
int main(int argc, char *argv[]){
	struct sigaction mySigAction;
	mySigAction.sa_sigaction = SignalHandler;
	mySigAction.sa_flags = SA_SIGINFO;
	sigemptyset(&mySigAction.sa_mask);
        sigaction(SIGPIPE, &mySigAction, NULL);
        ...
}

void SignalHandler(int sig, siginfo_t *info, void *context){
	NSLog(@"in SignalHandler");
}
but it doesn't work too.
iruirc is offline   Reply With Quote
Old 09-08-2011, 03:39 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 14
risma is on a distinguished road
Default

have you solved this problem?? can you share the answer?
i have a simillar problem here
risma is offline   Reply With Quote
Old 09-08-2011, 08:53 AM   #3 (permalink)
Knows SQL
 
iisword's Avatar
 
Join Date: Oct 2009
Location: Somewhere the streets are on fire, the sewers are flooded, and the cats are high on catnip
Posts: 529
iisword is on a distinguished road
Default

1)This thread is old, please start reading the dates.
2)Either SIG_IGN the signal and handle the error on writing or try changing the socket.
__________________

Last edited by iisword; 09-08-2011 at 08:58 AM.
iisword is offline   Reply With Quote
Old 09-12-2011, 07:08 AM   #4 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 14
risma is on a distinguished road
Default

Quote:
Originally Posted by iisword View Post

yes i know this is an old thread, but maybe he can share his answer about this problem.
thank you for your link, but i dont understand how to implement that, can you give me another help?
risma is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 347
9 members and 338 guests
2Apps1Day, akacaj, c2matrix, esoteric, givensur, mjnafjke, Pudding, SLIC, Techgirl-52
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:10 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0