I’m writing a TCP server.
Everything it has to do is to read/write text to/from TCP sockets and read/write this text to/from text files on the file system where the server runs.
If there’s a problem with the connection (e.g. the client closes the socket), the server blocked on a read/write receives a SIGPIPE signal. I want to ignore it: the server simply closes its socket’s end because the communication is now impossible.
Is it a good way?
Are there other signals I’ve to consider?
Many server programs choose to ignore
SIGPIPE, and use the return codes fromread/writeto have better understanding of the disconnection. For example,read/recvreturns0on a proper disconnect from the other end, and-1on error witherrnoset to one of multiple alternatives.