Open fatmehosseini opened 1 year ago
the example primarily shows receiving of UDP packets (and the echoing them). it will only send a packet when it received one. for some reason the designers of the UDP API at Arduino expected one would always listen to UDP packets too, while there are many scenarios when packets are only sent. so just skip the parsePacket part and only send a packet to any address and port.
my WiFiEspAT library has an UdpSender example. it is not fully applicable for Ethernet or EthernetENC library which always require Udp.begin
but the loop()
function should work.
https://github.com/JAndrassy/WiFiEspAT/blob/master/examples/Basic/UdpSender/UdpSender.ino
void loop() {
Udp.beginPacket(reciverIP, receiverPort);
Udp.print("Arduino millis ");
Udp.print(millis());
Udp.endPacket();
delay(5000);
}
My problem solved, I was trying to send the message on 239, 255, 255, 250 IP which is a multicast IP and in your library multicast sending is disabled. I changed the IP to broadcast IP and my message are received on Wire-shark now. By the way, is there any way that I could enable multi-casting in this library?
Hi, I am trying to send broadcast SSDP, based on this example https://github.com/arduino-libraries/Ethernet/blob/master/examples/UDPSendReceiveString/UDPSendReceiveString.ino by changing the IP to 239:255:255:250 and the port to 1900. But I don't receive any message on Wire Shark. This is my code: