Hi @habib,
the IPAddress Constructor is correct.
I tried your code with an ESP8266 laying around and it runs fine.
Connecting to Networkname
.......
WiFi connected
IP address: 192.168.xxx.61
Attempting MQTT connection…connected
Publishing to: /habib/arduino/command
so I’ve no idea, what can be wrong.
Can you see an logfile from your MQTT Broker?
I think there is no firewall between your ESP32 and the broker?
Or did you run the MQTT.fx Client on same host with the broker and you have enabled an firewall that prevent the esp32 from connecting?