sending and receiving ipv6 multicasts

"Martin v. Löwis" martin at v.loewis.de
Tue Apr 14 14:25:47 EDT 2009


> I get the following error: "socket.error: [Errno 22] Invalid
> argument". So it complains about the multicast address.

The fragment

py> import socket
py> s = socket.inet_pton(socket.AF_INET6, "ff02::1")
py> sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
py> sock.bind(('', 9090))
py> sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_JOIN_GROUP,
socket.inet_pton(socket.AF_INET6, "ff02::1")+'\0'*4)

works fine for me.

Regards,
Martin



More information about the Python-list mailing list