← index #2198Issue #3299
Related · high · value 3.961
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

Unable to receive Multicast Messages

closedby rohitranjan1991opened 2017-09-04updated 2017-09-06

I am running micropython 1.9.2 on ESP8266 and am able to send a multicast message from ESP8266. But i am unable to create a receiver which could accept the Multicast Message. Upon bootup ESP8266 connects to the wifi and then call the this method to receive the Multicast message. I am using the following code.

def receiver():
   s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
   s.bind(('',13176))
   print('waiting...')
   while True:   
        data,addr=s.recvfrom(1024)
        print('received:',data,'from',addr)

In the above code, i am not able to add the Multicast IP. Please suggest me how should i implement the code to add the Multicast IP. Thanks.

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