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
Hello everybody i'm currently working on a IOT project based on an esp32 that needs to be connected to a local mqtt broker and i have encounter a problem with the connection to the broker ,after some googling i have found that it can be a firewall problem so i had open the 1883 port
for the incoming traffic but nevertheless nothing changed the connection between the broker and other interfaces like node red or mqtt explorer is working fine
i have made some test to see if any of the ports is opened to other clients on the network but i get that all the ports is closed
also from my search on the net i remarked that the mosquitto folder does not have the proper config file where i can for example change the port or modify the authentication settings
can anyone help me to solve this problem i already tried some suggestions from #185 but nothing worked
her is my esp32 code :
#include <WiFi.h>
#include <PubSubClient.h>
int i;
WiFiClient espClient;
PubSubClient client(espClient);
void reconnectmqttserver() {
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
String clientId = "ESP32Client";
clientId += String(random(0xffff), HEX);
if (client.connect(clientId.c_str())) {
Serial.println("connected");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
delay(5000);
}
}
}
i have just run a test using Zenmap to scan for the default mqtt port 1883 the result was that the port was filtered , and from my search i understand that this state means there is a network obstacle blocking the port , any clue what should i search for ?
Hello everybody i'm currently working on a IOT project based on an esp32 that needs to be connected to a local mqtt broker and i have encounter a problem with the connection to the broker ,after some googling i have found that it can be a firewall problem so i had open the 1883 port
for the incoming traffic but nevertheless nothing changed the connection between the broker and other interfaces like node red or mqtt explorer is working fine
i have made some test to see if any of the ports is opened to other clients on the network but i get that all the ports is closed
also from my search on the net i remarked that the mosquitto folder does not have the proper config file where i can for example change the port or modify the authentication settings
can anyone help me to solve this problem i already tried some suggestions from #185 but nothing worked
her is my esp32 code :
#include <WiFi.h>
#include <PubSubClient.h>
int i;
WiFiClient espClient;
PubSubClient client(espClient);
void reconnectmqttserver() {
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
String clientId = "ESP32Client";
clientId += String(random(0xffff), HEX);
if (client.connect(clientId.c_str())) {
Serial.println("connected");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
delay(5000);
}
}
}
char msgmqtt[50];
void callback(char* topic, byte* payload, unsigned int length) {
String MQTT_DATA = "";
for (int i=0;i<length;i++) {
MQTT_DATA += (char)payload[i];}
}
void setup()
{
i = 0;
Serial.begin(9600);
WiFi.disconnect();
delay(3000);
Serial.println("START");
WiFi.begin("tp_link","01020304050");
while ((!(WiFi.status() == WL_CONNECTED))){
delay(300);
Serial.print("..");
}
Serial.println("Connected");
Serial.println("Your IP is");
Serial.println((WiFi.localIP()));
}
void loop()
{
}
The text was updated successfully, but these errors were encountered: