I am not sure if this belongs here or in the C board.
I have been writing a simple server program.
When a user connects I create a new thread to handle the user.
There is another program that is used as a client to connect to the server.
The user has the option to disconnect from the server. If the user does so I close out the socket and exit the thread.
But if the user just does ctrl-c to kill the client program then I get an error "Broken Pipe" on the server, and it crashes. I think this has to do with the socket still being open but no one on the other end.
Does anyone know any way to have the server handle the client program being killed with out crashing the server program?
Let me know if It would help for me to post the server code here.
I am writing the program in C, using gcc to compile on a FreeBSD unix machine.