EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1441 background imageLoading...
Page #1441 background image
Chapter 4. API Guides
Thread-safe sockets It is possible to close() a socket from a different thread to the one that created it. The
close() call will block until any function calls currently using that socket from other tasks have returned.
It is, however, not possible to delete a task while it is actively waiting on select() or poll() APIs. It is always
necessary that these APIs exit before destroying the task, as this might corrupt internal structures and cause subsequent
crashes of the lwIP. (These APIs allocate globally referenced callback pointers on stack, so that when the task gets
destroyed before unrolling the stack, the lwIP would still hold pointers to the deleted stack)
On demand timers lwIP IGMP and MLD6 features both initialize a timer in order to trigger timeout events at
certain times.
The default lwIP implementation is to have these timers enabled all the time, even if no timeout events are active. This
increases CPU usage and power consumption when using automatic light sleep mode. esp-lwip default behaviour
is to set each timer on demandso it is only enabled when an event is pending.
To return to the default lwIP behaviour (always-on timers), disable CONFIG_LWIP_TIMERS_ONDEMAND.
Lwip timers API When users are not using WiFi, these APIs provide users with the ability to turn off LwIP timer
to reduce power consumption.
The following API functions are supported. For full details see lwip/lwip/src/include/lwip/timeouts.h.
sys_timeouts_init()
sys_timeouts_deinit()
Abort TCP connections when IP changes CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES
is disabled by default. This disables the default lwIP behaviour of keeping TCP connections open if an interface IP
changes, in case the interface IP changes back (for example, if an interface connection goes down and comes back
up). Enable this option to keep TCP connections open in this case, until they time out normally. This may increase
the number of sockets in use if a network interface goes down temporarily.
Additional Socket Options
Some standard IPV4 and IPV6 multicast socket options are implemented (see Socket Options).
Possible to set IPV6-only UDP and TCP sockets with IPV6_V6ONLY socket option (normal lwIP is TCP
only).
IP layer features
IPV4 source based routing implementation is different.
IPV4 mapped IPV6 addresses are supported.
Limitations
Calling send() or sendto() repeatedly on a UDP socket may eventually fail with errno equal to ENOMEM.
This is a limitation of buffer sizes in the lower layer network interface drivers. If all driver transmit buffers are full
then UDP transmission will fail. Applications sending a high volume of UDP datagrams who dont wish for any to
be dropped by the sender should check for this error code and re-send the datagram after a short delay.
Increasing the number of TX buffers in the Wi-Fi project configuration may also help.
4.20.7 Performance Optimization
TCP/IP performance is a complex subject, and performance can be optimized towards multiple goals. The default
settings of ESP-IDF are tuned for a compromise between throughput, latency, and moderate memory usage.
Espressif Systems 1430
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish