User`s guide
KwikNet TCP/IP Sockets
K
A
DAK
199
kn_errno kn_errno
Purpose Get Error Code from Recent Socket Operation
Used by
n Task o ISP o Timer Procedure o Restart Procedure o Exit Procedure
Setup Prototype is in file KN_SOCK.H.
#include "KN_SOCK.H"
int kn_errno(int s);
Description S is a socket descriptor identifying the socket from which error
information is to be retrieved.
Returns If successful, a positive error code is returned. These error codes are
summarized in Appendix B. The error code identifies the reason for the
failure, if any, of the most recent operation attempted using socket s.
An error status of EBADF is returned if the socket descriptor s is invalid,
precluding the interrogation of the socket.
Usually the error code retrieved from socket s corresponds to the result of
the most recent sockets call made by your application. However, since
KwikNet always records any relevant socket error which it detects, your call
to kn_errno() may actually retrieve an error code recorded by KwikNet at
some time after your socket operation.
For example, the following error codes, if observed, could indicate that the
corresponding error on the socket referenced by descriptor s was detected
by KwikNet asynchronously to your application.
ESHUTDOWN The connection has been shut down.
ECONNRESET The connection has been reset.
Note You can use this procedure to advantage to interrogate the status of a
listening socket while it continues to operate.
Note The error code associated with socket
s remains unaltered. To read the
error code and reset the error code to
0, call kn_getsockopt() with
option SO_ERROR.
See Also kn_getsockopt()