I have a small project that has to output to two different IPs at the same time if possible,
I have one up and running ok but can’t seem to register a second Socket.
Does anyone have any pointers.
thanks in advance
Martin
What I have learned for things like this, is to declare/define everything related to a single socket into a Class. then initialize multiple instances of that class for each and every socket you need with the appropriate callbacks as needed. That typically works.
This allows each class to be mutually exclusive to one another but also tie back to a common point. So treat the socket and its methods/functions related to that socket as its own object instance.
In my case, I needed/use multiple MQTT client listeners that basically do the same thing, just monitor different subtopics for different IDs. So, i just put all the code in a single class, and initialized that same class into an array with different initialization data for each one. It worked fine.