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
Unable to receive Multicast Messages
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.