Convert IPv6 address to binary representation on 2.x/Windows

"Martin v. Löwis" martin at v.loewis.de
Wed Mar 4 18:02:26 EST 2009


>> I do wonder why you need a binary representation of an IPv6 address...
> I'd like to subscribe to an IPv6 multicast address via
> socket.setsockopt(IPPROTO_IPV6, IPV6_JOIN_GROUP, binary_address).

I see.

>> Yes, writing your own routine is certainly an option.
> Is it the preferred one?

Preferred by whom? I would prefer to pass a socket.ipv6_mreq structure
to IPV6_JOIN_GROUP, rather than a byte array. Failing that, I would
prefer to use inet_pton. Since the first one is not implemented, and the
second one not on Windows, I would prefer to receive patches that
make them implemented.

Regards,
Martin



More information about the Python-list mailing list