I am trying to build a prototype where basically I want to send the same message string(from an Arduino itself)to all the connected arduinos in a network(network will have only arduinos) have searched for ways to send a broadcast message using the wifi library but I haven't found a concrete answer to it's possibility and success.So , my question is , instead of sending a broadcast from arduino itself, Can't I just simply send it to one specific port , and then configure my router to forward that port to all the ports (ie range of ports)? It seems to me it is very possible but then no one really mentioned this simple alternative in the threads I read so is there something wrong with this implementation?
Was going to suggest MQTT but there is no MQTT broker that runs on Arduino only. You would need a more powerful device for the central hub device (someone claims to have an MQTT broker for ESP8266 but I've not tried it.)
Unfortunately you are stuck sending individual messages to each device (even MQTT does this under the hood).
Port forwarding is only a one-to-one service, usually used to allow a device on the internet to make an inbound connection to a device on your LAN.
Hey thanks for the input,I didn't know about this publish/subscribe method at all beforehand.I just checked that the router I am using is OpenWRT compatible , and OpenWRT has an implementation of MQTT in the form of 'mosquitto' , do you think it will work for the setup I speak of?
That may well work provided you have sufficient resources (CPU & Memory) available on your router. Depends on the number of nodes and message throughput. Otherwise a Raspberry Pi or similar would work.