Chapter 4. API Guides
IPv6 options IPv6 sockets only. Used with level argument IPPROTO_IPV6
• IPV6_CHECKSUM
• IPV6_V6ONLY
For multicast IPv6 UDP sockets:
• IPV6_JOIN_GROUP / IPV6_ADD_MEMBERSHIP
• IPV6_LEAVE_GROUP / IPV6_DROP_MEMBERSHIP
• IPV6_MULTICAST_IF
• IPV6_MULTICAST_HOPS
• IPV6_MULTICAST_LOOP
fcntl
The fcntl() function is a standard API for manipulating options related to a file descriptor. In ESP-IDF, the
Virtual filesystem component layer is used to implement this function.
When the file descriptor is a socket, only the following fcntl() values are supported:
• O_NONBLOCK to set/clear non-blocking I/O mode. Also supports O_NDELAY, which is identical to
O_NONBLOCK.
• O_RDONLY, O_WRONLY, O_RDWR flags for different read/write modes. These can read via F_GETFL only,
they cannot be set using F_SETFL. A TCP socket will return a different mode depending on whether the
connection has been closed at either end or is still open at both ends. UDP sockets always return O_RDWR.
ioctls
The ioctl() function provides a semi-standard way to access some internal features of the TCP/IP stack. In
ESP-IDF, the Virtual filesystem component layer is used to implement this function.
When the file descriptor is a socket, only the following ioctl() values are supported:
• FIONREAD returns the number of bytes of pending data already received in the socket’s network buffer.
• FIONBIO is an alternative way to set/clear non-blocking I/O status for a socket, equivalent to fcntl(fd,
F_SETFL, O_NONBLOCK, ...).
4.20.3 Netconn API
lwIP supports two lower level APIs as well as the BSD Sockets API: the Netconn API and the Raw API.
The lwIP Raw API is designed for single threaded devices and is not supported in ESP-IDF.
The Netconn API is used to implement the BSD Sockets API inside lwIP, and it can also be called directly from
ESP-IDF apps. This API has lower resource usage than the BSD Sockets API, in particular it can send and receive
data without needing to first copy it into internal lwIP buffers.
Important: Espressif does not test the Netconn API in ESP-IDF. As such, this functionality is enabled but not
supported. Some functionality may only work correctly when used from the BSD Sockets API.
For more information about the Netconn API, consult lwip/lwip/src/include/lwip/api.h and this wiki page which is
part of the unofficial lwIP Application Developers Manual.
4.20.4 lwIP FreeRTOS Task
lwIP creates a dedicated TCP/IP FreeRTOS task to handle socket API requests from other tasks.
A number of configuration items are available to modify the task and the queues (“mailboxes”) used to send data
to/from the TCP/IP task:
Espressif Systems 1428
Submit Document Feedback
Release v4.4