← index #2198PR #13166
Related · high · value 0.284
QUERY · ISSUE

Not able to send Multicast messages from ESP8266

openby mostleyopened 2016-06-25updated 2021-08-11
port-esp8266

Simple multicast message example that doesn't work on the ESP8266:

import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
data = "test data".encode('utf-8')
sock.sendto(data, ('239.0.0.10', 3535))

works with micropython on osx though.

I was experimenting with an Nodemcu v2 ESP8266
MicroPython v1.8.1-31-g9de5eb2 on 2016-06-10

CANDIDATE · PULL REQUEST

docs/esp32: UDP MULTICAST client/server example.

openby IhorNehrutsaopened 2023-12-10updated 2024-11-02
port-esp32

Use UDP MULTICAST connections to communicate between different networks.
For example between ESP32 with 172.16.55.55 IP address from B class network and
ESP32 with 192.168.44.44 IP address from C class network.

Run udp_multicast_client.py on one device. Client send GET and receive ACK from the server.
Output is:

GET to   ('224.0.0.111', 5555)   sent     "client_ip:172.16.55.55  mac:b8-d6-1a-5a-c2-e4"
ACK from ('192.168.44.44', 5555) received "server_ip:192.168.44.44 mac:24-6f-28-7a-f3-9c"
GET to   ('224.0.0.111', 5555)   sent     "client_ip:172.16.55.55  mac:b8-d6-1a-5a-c2-e4"
ACK from ('192.168.44.44', 5555) received "server_ip:192.168.44.44 mac:24-6f-28-7a-f3-9c"
...

Run udp_multicast_server.py on another device. Server receive GET and send ACK to the client.
Output is:

GET from ('172.16.55.55', 5555) received "client_ip:172.16.55.55  mac:b8-d6-1a-5a-c2-e4"
ACK to   ('224.0.0.111', 5555)  sent     "server_ip:192.168.44.44 mac:24-6f-28-7a-f3-9c"
GET from ('172.16.55.55', 5555) received "client_ip:172.16.55.55  mac:b8-d6-1a-5a-c2-e4"
ACK to   ('224.0.0.111', 5555)  sent     "server_ip:192.168.44.44 mac:24-6f-28-7a-f3-9c"
...

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied