What im trying to do is connect to a remote server , read contents from a file on the local machine and send it over to the server. Then capture the server response and sav
On Linux, and probably other Unixes, the return code encodes a signal that the process received. Here it is 141 - 128
so 13
which corresponds to SIGPIPE
.
If you don't want that signal to be raised because you capture the error return of send, anyhow, on Linux you can use MSG_NOSIGNAL
in the flags
argument to send
to inhibit that signal. On other platforms you might have to program more complicated signal handlers to deal with that situation.