I'm trying to implement an easy server/client with handler for signals.
My only use for signals will be sigaction(SIG...,&sig,NULL), where:
sig.sa_sigaction = &closeSig;
sig.sa_flags = SA_SIGINFO;
void closeSig{
send(ds_sock,"close",1024,0);
close(ds_sock);
exit(1);
}
If the server (or the client) receives "close", it simply closes the connection.
In this situation, is it useful to use the sigset_t, and add in it all the signals I wanto to handle, and then use sigaction like up, instead using only e sigaction?
If it's useful, can you explain me the reason? I've a beta program, and it uses a sigset on the server, but it doesn't on the client.. Thanks!
edit: I've just found out that the server also uses sigprocmask with unblock. If I don't want to use it, and I want all signals to be unblocked and that they immediatly launch their handler, I don't have to use a sigset, right? Thanks!
I'm sorry, but I can't post the code. If you can help me, that's good, if you can't, thanks anyway!