EasyManuals Logo

Espressif Systems ESP User Manual

Default Icon
191 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 #114 background imageLoading...
Page #114 background image
Chapter 4. Software framework
How to choose the default route when ESP32 works as dual NICs (e.g. ETH+STA)?
The following summarizes how the default route is selected for dual NICs, using ETH and STA as
examples.
Supposing ETH and STA are in the same LAN:
When the device accesses the LAN address, the data will go to the last up netif.
When the device accesses the non-LAN address, the data will go to the netif with the larger
route_prio value.
Supposing ETH and STA are not in a LAN, ETH belongs to 192.168.3.x segment, and STA belongs
to 192.168.2.x segment:
When the device accesses 192.168.3.5, it will take the ETH netif.
When the device accesses 192.168.2.5, it will take the STA netif.
When the device accesses 10.10.10.10, it takes the default route (the netif with the larger
route_prio value). When netif is up, it sets the default route based on the route_prio
value size, and the default route is often the netif with the larger route_prio value. When
the device accesses an address that is not inside the routing table, the data takes the default
route.
How do I enable keepalive for TCP in ESP-IDF?
You can refer to the code for enabling TCP keepalive in esp_tls.c.
Is it possible to operate the same socket in multiple threads in ESP-IDF?
In ESP-IDF, it is possible for multiple threads to share one single socket for communication. Each thread
can use the same socket to send and receive data, but it is important to ensure thread synchronization
when accessing the socket to avoid race conditions and deadlocks. Typically, a mutex can be used to
control access to the socket, ensuring that each threads access to the socket is mutually exclusive to
avoid data corruption caused by concurrent access to the socket. However, operating on the same socket
from multiple threads is risky, and it is not recommended.
How much time do ESP devices allocate to other devices IPs in ESP DHCP server mode?
The default is 120 s. Please refer to the
DHCPS_LEASE_TIME_DEF
parameter, which is not recom-
mended to be set to a small value.
What are the three lease related times in ESP-IDF DHCP? What parameters in the code do they correspond
to?
They are Address Lease Time, Lease Renewal Time and Lease Rebinding Time, corresponding to the
lwIP codes offered_t0_lease, offered_t1_renew, and offered_t2_rebind respec-
tively.
Espressif Systems 97
Submit Document Feedback
Release master

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif Systems ESP and is the answer not in the manual?

Espressif Systems ESP Specifications

General IconGeneral
BrandEspressif Systems
ModelESP
CategoryMotherboard
LanguageEnglish