Potintial UDP library conflect

Hi Arduino smart people:

Building a ESP32 project, I'd like to add UDP support to communicate with other machines on my network.

Accidentally, without adding "#include <WiFiUDP.h>" I added a line to create an instance, thus...
"WiFiUDP relayUDP;"

It surprised me that this instance creation did not fail, but, OK...
However, I am unable to use the relayUDP.

Looking around, I noted another WiFiUDP instance, "WiFiUDP ntpUDP;"

I had added "#include <NTPClient.h>", and in that file there is an #include <Udp.h>.
Earlier I had added and debugged getting time using NTPClient.h.

So, I am thinking Udp.h may support some functions in WiFiUDP.h, but either implement them differently or not handle all I need.

  1. What would be the recommended solution to this? (This isn't the first time I have run across multiple libraries that have the same function names in them.)

  2. Are WiFiUDP.h and Udp.h totally interchangeable? (I suspect not.) Is one "superior" to the other? can I simply use WiFiUDP.h in place of Udp.h? (again, I suspect not.)

  3. If I include WiFiUDP.h...

    a) How can I differentiate between using the two WiFiUDP instances?

    b) What other functions will conflict?

Thanks for any insight to this problem.

Mark.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.