|
Errno may not be reset from a previous value. For example, if you call recv() once, and receive EINTR, errno will remain set to EINTR until some other error occurs.
Therefore, you shouldn't use errno to detect if there's an error or not. You should only check it's value when you know that there's an error, and you want to know what the error is.
Personally, I typically do something like this: recvlen = recv( . . . ); if (recvlen = -1); err = errno; select; when err = EINTR; // timeout! when err = (other expected error); // handle appropriately other; errMsg = %str(strerror(Errno)); // show error to user; endsl; endif; // no error -- handle received data.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.