Comments (3)
The same code used on ESP8266 never have problem.
But on ESP32, when there is some trouble on DNS lookup, and the result of "beginPacket" is not checked.
I think it will lead UDP stack with dirt data and cause the DNS lookup always failed.
The following code will fix this problem, but maybe some update is need is better for users. Because I spend month to catch the reason.
void loop()
{
delay(1000)
if (m_WiFiUDP.beginPacket("xxx.com", 5050))
{
m_WiFiUDP.write((const uint8_t *)&SomeData, 20);
m_WiFiUDP.endPacket();
}
}
The root reason caused this problem.
C:\Users\xxx.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFiUdp.cpp
line 168
int WiFiUDP::beginPacket(const char *host, uint16_t port){
struct hostent *server;
server = gethostbyname(host);
if (server == NULL){
log_e("could not get host from dns: %d", errno);
return 0;
}
return beginPacket(IPAddress((const uint8_t *)(server->h_addr_list[0])), port);
}
from arduino-esp32.
@me-no-dev can you please take a look? thanks
from arduino-esp32.
Please try with 3.0.1
from arduino-esp32.
Related Issues (20)
- HTTPClient should allow for setting own Accept-Encoding header HOT 2
- FlashMemory Address for EEPROM HOT 4
- Boot Loop When Enabling USB CDC On Boot with RMT Driver HOT 6
- ESP32 WiFiScan: no networks found HOT 4
- BluetoothSerial::flush() takes too long HOT 2
- printf compile "expects argument of type 'int'" warnings on IDF_VER 5.1 HOT 2
- Log strings visible in firmware.bin even if the CORE_DEBUG_LEVEL is set to 0
- Persistent Boot Failure on ESP32-S3 HOT 18
- loop freeze: arduino framework HOT 8
- ESP32 Arduino BLE Refactoring HOT 4
- sntp problem with 3.0 HOT 34
- ERROR: Because espressif/arduino-esp32 (3.0.1) depends on idf (>=5.1,<5.2) HOT 1
- error: 'virtual int Client::connect(IPAddress, uint16_t)' was hidden [-Werror=overloaded-virtual=] HOT 1
- Preferences documentation error - getBool call definition displays getUChar. HOT 1
- ESP-IDF 5.2.2 Arduino as a component (IDFGH-13064) HOT 2
- NimBLE does not work with Arduino Nano ESP32 HOT 1
- WiFiClient and related macros - troubles when using forward declarations HOT 14
- Add support for Elecrow CrowPanel 7.0".
- invert status never reset on serial0 after having been set to invert once HOT 2
- More than one HTTPS client; Arduino as ESP-IDF component HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-esp32.