Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By ShantanuJ
#54299 I have run an MQTT code on my NodeMcuesp12E. Works perfectly.

Then I have run a UDP broadcast code on the smae module. Also works perfectly.

My question is, Is it possible for me to run both MQTT and UDP together on the same module?

1. Either work parallelly

OR

2. If one fails, Start another while waiting for the previous connection to come back.

Any kind of help is very much appreciated.
Also some examples pointing to the same or similar issue will also help.
Thank You in advance.
User avatar
By rudy
#54301 Certainly 2 and as far as I know also 1.

But there may be buts. If you are trying to connect to two different networks then you might be trying to connect to different channels and that isn't possible with the radio in the ESP8266. But if you are connecting to the same channel then it should work.

An example of using UDP and TCP-IP together would be a sketch that has a server, or a client, and also goes to the Internet to fetch the time. Time uses UDP.

This is a bit complex but it uses both.
https://github.com/chaeplin/esp8266_and ... rature.ino

https://github.com/chaeplin/esp8266_and ... t-test.ino