On Sat, 8 Oct 2005, YH wrote:
Spot on! This is exact the issue I've been troubled. If my server program can detect the termination of a client program, it can close the client's fd and remove it from fd_set. The problem is, my server program could not catch SIGBUS/SIGSEGV, nor SIGPIPE or other signals from the termination of the client program in my RH 9.0. I am not sure if it is the RH 9.0 problem or the normal networking behavior.
I don't quite follow. Is your server program crashing, or is it not crashing? If it is crashing, in what way is it crashing?
Since my server program only passes a notification to high level applications when get a packet from select(), it is not even practical for my server program to check the return value from the read().
You can only detect client close by the result of read().
(1) Using signal function call to catch a signal from termination of a client (it does not work currently in RH 9.0).
There is no such signal.
(2) Find a networking system call, if there is, the client program can inform the server it is off before terminating.
This is close(), which is indicated with read() returning 0 ... Regards Henrik - : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html