I’m trying to write a simple UDP Multicast listener for a Pico Pi + Wiznet Ethernet Hat. Seems the feature is supported by the W5100S. Is there an example in Micropython that illustrate that use case?
Currently, there are no examples provided by Wiznet. You have to implement it yourself using the basic UDP example.
– UDP multicast refrence–
– UDP example –
from machine import Pin, SPI, UART
import network
import usocket as socket
spi = SPI(0, 2_000_000, mosi=Pin(19), miso=Pin(16), sck=Pin(18))
nic = network.WIZNET5K(spi, Pin(17), Pin(20))
nic.active(True)
nic.ifconfig((‘192.168.11.106’, ‘255.255.255.0’, ‘192.168.11.1’, ‘8.8.8.8’))
UDPServer_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
UDPServer_socket.bind((‘192.168.11.106’, 8888))
while True:
data,addr= UDPServer_socket.recvfrom(30)
print(data, addr)
Thank you @scarlet. In my view, the key advantage of UDP multicast is that it eliminates the need to set up the IP of each individual device.
However, this example assigns an IP to the device prior to setting up the listener.
The devices can simply listen to a MULTICAST_GROUP/PORT without any initial configuration. This makes UDP suitable for device discovery and remote network setup.
Can you point me to a different example that illustrates the use of UDP multicast listening without explicitly setting the IP of the device?
Can you at least confirm that W5100S supports the feature?