Use Socket with Multicast (for Websocket-usage)



  • Hi,

    i would like to execute:

    import usocket as socket
    import ustruct as struct
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # optional
    mcast = struct.pack('4sL', socket.inet_aton('239.255.255.250') , socket.INADDR_ANY)
    sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mcast)
    sock.bind(('', 1900))
    

    but it seems like it is not implemented in the usocket-module. is there any way to get this to run?

    thanks alot!


Log in to reply
 

Pycom on Twitter