← index #2198Issue #8688
Related · medium · value 0.738
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 · ISSUE

ESP8266 v1.18 Unreliable UDP Receiving From Broadcast Address (ex 192.168.1.255)

closedby PsuFanopened 2022-05-21updated 2024-09-08
bugneeds-info

Anyone else having issues receiving UDP packets? I can send 10-20 packets and only receive one packet. I send them with another esp or with my computer and can see the packets in Wireshark but hardly any are received with the 8266. It seems to be substantially worse when I send to the broadcast (ex 192.168.1.255) vs directly to the esp IP address. Should I be using a multicast address instead? Not sure what the differences are.

socket = socket(AF_INET, SOCK_DGRAM)
socket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
socket.bind(('', 1011))
socket.setblocking(False)

while True:
	try:
		data, addr = self.socket.recvfrom(1024)
		print('Recv Data From %s' % str(addr))
	except OSError as err:
		if err.args[0] != 11:
			print(err)

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