> If your application is crashing in select() with a SIGBUS/SIGSEGV error
> then somehow gave bad fd_set pointers to select(). This is not related
> to clients closing/aborting their connections.
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.
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().
My original solutions were:
(1) Using signal function call to catch a signal from termination of a
client (it does not work currently in RH 9.0).
(2) Find a networking system call, if there is, the client program can
inform the server it is off before terminating. I was imaging as there
is a pair system function of accept / connect for setting up a
connection, it might be another system function call to let client
program inform the server before terminating. But, I could not find from
Stevens's book. I could be missing something here, hope someone on this
list can give me a clue.
Thank you.
Jim
Henrik Nordstrom wrote:
On Thu, 6 Oct 2005, YH wrote:
Jeff is right, the read() returns 0, not -1. Anyway, the server
program was crashed at select() as in my previous email. It is not the
write() problem as there is no write() in my server program. As I said
in my last email, I am really looking for a network system call to
gracefully respond the client termination. The SIGPIPE with SIG_IGN
did not work.
The graceful response to a client terminate is close() and then forget
about the fd.
If your application is crashing in select() with a SIGBUS/SIGSEGV error
then somehow gave bad fd_set pointers to select(). This is not related
to clients closing/aborting their connections.
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