|
|
Generally, each system service maps its error conditions to the generic error codes defined by the operating system. However, some errors have been added especially for SCO TCP/IP.
Check for error returns after every system call. Most calls have associated error values which are described in the manual page for the call. An error condition is indicated by an otherwise impossible return value, usually -1. An error number is provided in the external variable errno, which is set only when an error occurs and is not cleared on successful calls. Consequently, check it only after an error has been indicated. Use perror(S) to print error messages. With sockets, if information at the sending node indicates that the message cannot be delivered (for instance, when a network is unreachable), the call returns -1 and the global variable errno contains an error number.