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 #115 background imageLoading...
Page #115 background image
Chapter 4. Software framework
What is the maximum length for each data transmission in the ESP-IDF lwIP?
If you are using the socket interface send, the maximum length supported is determined by the
SSIZE_MAX parameter. If you use the tcp_write function, the maximum length is limited by
snd_buf
(send bu󰝗er length).
send
is a socket interface wrapped by lwIP based on the sequential
API, which is a higher-level interface than tcp_write and is more suitable for user-level calls. There
is basically no di󰝗erence in resource usage between the two API calls.
If I need more debug logs for lwIP layer related issues with ESP-IDF, how can I enable the corresponding
debug log to be printed (e.g. DHCP, IP)?
To print lwIP-related debug log, open menucon󰝘g, go to Component config -> LWIP, and enable the
option Enable LWIP Debug. There are sub-options, including Enable IP debug messages and
Enable DHCP debug messages. You could enable them as needed.
If you dont 󰝘nd the desired debug log module in the above menucon󰝘g, such as, UDP module, 󰝘rst check
if there is #define UDP_DEBUG in esp-idf/components/lwip/port/esp32/include/
lwipopts.h. If yes, change #define UDP_DEBUG LWIP_DBG_OFF to #define UDP_DEBUG
LWIP_DBG_ON manually. If no, add #define UDP_DEBUG LWIP_DBG_ON to esp-idf/
components/lwip/port/esp32/include/lwipopts.h referring to #define UDP_DEBUG
LWIP_DBG_OFF in esp-idf/components/lwip/lwip/src/include/lwip/opt.h 󰝘le.
What is the dierence between socket blocking and non-blocking in ESP-IDF?
For reads, the di󰝗erence is whether the read interface returns immediately when no data arrives at the bottom.
A blocking read will wait until data has arrived or until an exception occurs, while a non-blocking read will
return immediately with or without data.
For writes, the di󰝗erence is whether the write interface returns immediately when the underlying bu󰝗er is
full. For blocking write, if the underlying bu󰝗er is not writable (the underlying bu󰝗er is full or the peer has
not acknowledged the previously sent data), the write operation will keep blocking until it is writable or an
exception occurs. For non-blocking write, it will write as much as it can without waiting for the underlying
bu󰝗er to be writable or the length of the write to be returned.
The non-blocking interface call does not block the current process, while the blocking interface does.
Can ESP32 use the IP of the previous successful connection for communication after connecting to the router,
and in case of failure, re-enter the authentication process and use DHCP to obtain a new IP?
Yes, if you enable Component config -> LWIP ->DHCP: Restore last IP obtained from
DHCP server option in menucon󰝘g.
Note that you cannot use a static IP instead, because static IP settings do not have con󰝙ict detection. It may
lead to IP con󰝙ict.
How do I achieve connect_timeout when programming with sockets?
If you set the socket to the non-blocking mode, the connect() function will also be non-blocking. Then you can
set the timeout by the select() function to determine whether the socket is connected successfully or not. For
details, please refer to connect_timeout settings of sockets.
Espressif Systems 98
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