Chapter 4. API Guides
Error code Description
ECONNREFUSED Connection refused
EADDRINUSE Address already in use
ECONNABORTED Software caused connection abort
ENETUNREACH Network is unreachable
ENETDOWN Network interface is not configured
ETIMEDOUT Connection timed out
EHOSTDOWN Host is down
EHOSTUNREACH Host is unreachable
EINPROGRESS Connection already in progress
EALREADY Socket already connected
EDESTADDRREQ Destination address required
EPROTONOSUPPORT Unknown protocol
Socket Options
The getsockopt() and setsockopt() functions allow getting/setting per-socket options.
Not all standard socket options are supported by lwIP in ESP-IDF. The following socket options are supported:
Common options Used with level argument SOL_SOCKET.
• SO_REUSEADDR (available if CONFIG_LWIP_SO_REUSE is set, behavior can be customized by setting CON-
FIG_LWIP_SO_REUSE_RXTOALL)
• SO_KEEPALIVE
• SO_BROADCAST
• SO_ACCEPTCONN
• SO_RCVBUF (available if CONFIG_LWIP_SO_RCVBUF is set)
• SO_SNDTIMEO / SO_RCVTIMEO
• SO_ERROR (this option is only used with select(), see Socket Error Handling)
• SO_TYPE
• SO_NO_CHECK (for UDP sockets only)
IP options Used with level argument IPPROTO_IP.
• IP_TOS
• IP_TTL
• IP_PKTINFO (available if CONFIG_LWIP_NETBUF_RECVINFO is set)
For multicast UDP sockets:
• IP_MULTICAST_IF
• IP_MULTICAST_LOOP
• IP_MULTICAST_TTL
• IP_ADD_MEMBERSHIP
• IP_DROP_MEMBERSHIP
TCP options TCP sockets only. Used with level argument IPPROTO_TCP.
• TCP_NODELAY
Options relating to TCP keepalive probes:
• TCP_KEEPALIVE (int value, TCP keepalive period in milliseconds)
• TCP_KEEPIDLE (same as TCP_KEEPALIVE, but the value is in seconds)
• TCP_KEEPINTVL (int value, interval between keepalive probes in seconds)
• TCP_KEEPCNT (int value, number of keepalive probes before timing out)
Espressif Systems 1427
Submit Document Feedback
Release v4.4