You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Board: ESP32 Dev Module
Core Installation/update date: latest
IDE name: Platform.io with Visual Studio Code
Flash Frequency: ?40Mhz?
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Mac OSX
Description:
I'm trying to connect and send a message via MQTT over WiFi. Code that used to run flawlessly now fails with error [WiFiClient.cpp:443] connected(): RES: -1. I'm not sure what is causing it. I'm using the PubSubClient library to send and receive MQTT message.
I'm connecting to WiFi in the standard way:
boolmyWiFi::connect(String *ssid, String *pass)
{
Serial.print("Connecting to WiFi");
WiFi.mode(WIFI_STA);
while (WiFi.status() == 255)
; //wait till WiFi is availableif (!WiFi.reconnect() )
{
WiFi.begin(ssid->c_str(), pass->c_str());
}
unsignedlong millis_rto = millis();
unsignedlong millis_cto = millis();
while (WiFi.waitForConnectResult() != WL_CONNECTED)
{
Serial.print(".");
if (millis() - millis_rto >= RETRY_TIMEOUT)
{
//reset timer
millis_rto = millis();
//start new try
Serial.print("\nConnecting to WiFi");
WiFi.begin(ssid->c_str(), pass->c_str());
}
if (millis() - millis_cto >= CONN_TIMEOUT)
{
Serial.println("\nWiFi connection timed out, open AP.");
getConfig(ssid, pass);
returnfalse;
}
delay(500);
}
Serial.print("\nConnected to WiFi with IP ");
Serial.println(WiFi.localIP());
returntrue;
}
The connection works, the error message appears after a successful connection and receiving an IP.
I'm tracing the WiFi events to find out what's going on with WiFi.onEvent(WiFiEvent). I'm getting the expected sequence of events:
Connecting to WiFi
WiFi Event: 0
WiFi Event: 2
WiFi Event: 5
Connecting to WiFi.
WiFi Event: 4
WiFi Event: 7
Connected to WiFi with IP 192.168.178.57
But then the following error occurs:
[E][WiFiClient.cpp:443] connected(): RES: -1
Despite this error message, the first MQTT package is being sent. When I call the mqtt.loop() function though, this error appears in every tick.
Again, this code worked for months now, this error message is new after updating the libraries to the latest version. I'm looking for help on how to find the cause for this error, I'm not sure where to start.
The text was updated successfully, but these errors were encountered:
Aietes
changed the title
WiFi connection drops [WiFiClient.cpp:443] connected(): RES: -1
WiFi connection error [WiFiClient.cpp:443] connected(): RES: -1
Dec 2, 2018
I'm realizing that this must be connected to the PubSubClient making a connection to an MQTT server via WiFiClient, so probably this error has little to do with the actual connection to the AP. I'll reference this issue in PubSubClient.
Aietes
changed the title
WiFi connection error [WiFiClient.cpp:443] connected(): RES: -1
WiFiClient error [WiFiClient.cpp:443] connected(): RES: -1
Dec 2, 2018
Hardware:
Board: ESP32 Dev Module
Core Installation/update date: latest
IDE name: Platform.io with Visual Studio Code
Flash Frequency: ?40Mhz?
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Mac OSX
Description:
I'm trying to connect and send a message via MQTT over WiFi. Code that used to run flawlessly now fails with error [WiFiClient.cpp:443] connected(): RES: -1. I'm not sure what is causing it. I'm using the PubSubClient library to send and receive MQTT message.
I'm connecting to WiFi in the standard way:
The connection works, the error message appears after a successful connection and receiving an IP.
I'm tracing the WiFi events to find out what's going on with WiFi.onEvent(WiFiEvent). I'm getting the expected sequence of events:
But then the following error occurs:
Despite this error message, the first MQTT package is being sent. When I call the mqtt.loop() function though, this error appears in every tick.
Again, this code worked for months now, this error message is new after updating the libraries to the latest version. I'm looking for help on how to find the cause for this error, I'm not sure where to start.
The text was updated successfully, but these errors were encountered: