@jon said in Multicast receiver Issue:
import socket
import pycom
server_address = ('', 10001)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #supposedly automatically works out the socket cast type??
sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
sock.bind(server_address)
def rxstream(item1, item2):
try:
print('starting rxstream')
#sock.settimeout(5)
while stop > 0:
print('before')
data, address = sock.recvfrom(64)
print('recieved %s from %s port %s' % (data, address[0], address[1]))
except OSError as err:
print('unexpected exception - on rx stream socket %s' % (err))
except:
print('hmmm')
finally:
print('bye ')
pycom.rgbled(0x0000ff)
time.sleep(1)
_thread.start_new_thread(rxstream, (1,2))
It would seem this is not currently supported in micropython: https://github.com/micropython/micropython/issues/2691
But it is supported in the ESP32 IDF so you could do this in C and make a micropython module if you wanted. See: https://github.com/espressif/esp-idf/tree/master/examples/protocols/udp_multicast