I’ve got a TCP server and client written in C that opens up a connection that should be open forever. On the first send, errno returns 0 which is fine. On subsequent sends it gives me an errno 60 which is that the operation timed out. The packet is still recieved by the server though and nothing seems to be wrong. What could cause the the errno being set? Is it best to just ignore this error since it seems to be working correctly?
Share
Random guess:
errnois only set when a function fails. If the function does not fail,errnois left as-is. It is not set to 0. The following is wrong:Instead, you must check the result of send:
You can confirm this with the following program:
which outputs:
(Note: assuming STDOUT is fd 1)