SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
One of the main differences between the implementation of BSD sockets and SimpleLink sockets is that error codes are returned directly when using SimpleLink sockets, and not through the errno method (as in Linux). Errors are indicated by the return value of the API, or by asynchronous events. Asynchronous events can be sent to the host at any given time with a specific error indication and include specific data for each event. To listen to these events and conclude the needed information, a handler should be implemented in the user application and registered under the user.h header file. Each error code is unique. The following errors are common and require user action (full possible error list is under the file error.h in the host driver).
Table 7-5 lists errors indicated by asynchronous events.
Error | Handler | Comments |
---|---|---|
SL_SOCKET_TX_FAILED_EVENT | slcb_SockEvtHdlr | Socket error – include the parameters status (specified in Table 7-6 and socket ID) |
Table 7-6 lists common errors status codes.
Error | Value | Comments |
---|---|---|
SL_ERROR_BSD_SOC_ERROR | –1 | General socket error |
SL_ERROR_BSD_INEXE | –8 | Socket command in execution |
SL_ERROR_BSD_EBADF | –9 | Bad file number |
SL_ERROR_BSD_ENSOCK | –10 | The system limit on the total number of open sockets has been reached. |
SL_ERROR_BSD_EAGAIN | –11 | Try again |
SL_ERROR_BSD_ECLOSE | –15 | Close socket operation failed to transmit all queued packets. |
SL_ERROR_BSD_EINVAL | –22 | Invalid argument |
SL_ERROR_BSD_EPROTOTYPE | –91 | Protocol wrong type for socket |
SL_ERROR_BSD_EADDRINUSE | –98 | Address is already in use |
SL_ERROR_BSD_ENETUNREACH | –101 | Network is unreachable |
SL_ERROR_BSD_ETIMEDOUT | –110 | Connection timed out |
SL_ERROR_BSD_ECONNREFUSED | –111 | Connection refused |
SL_ERROR_BSD_EALREADY | –114 | Nonblocking connect in progress, try again |