QUERY · ISSUE
Not able to send Multicast messages from ESP8266
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)
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)