socket-cpp
socket-cpp copied to clipboard
CTCPServer::Send can result in SIGPIPE
First, thanks for this project. Quite useful.
One issue I've noticed so far: If the connection gets disconnected for some reason just before a CTCPServer::Send call, then Send will result in a SIGPIPE under Linux, aborting the program.
Instead, this should be handled gracefully (ex Send should return an error).
Hello logidelic,
You're welcome.
Some insights to fix this issue : https://stackoverflow.com/questions/108183/how-to-prevent-sigpipes-or-handle-them-properly https://stackoverflow.com/questions/48229430/sigpipe-in-c-determining-which-tcp-socket-is-disconnected
Thanks for that. Yea, for the send call, I ended up changing the flags passed to MSG_NOSIGNAL (I think recv needs the same). IMO this be the default for this lib, but I'll let you decide. :)