Detecting IPv6 support

Pekka Pessi Pekka.Pessi at nokia.com
Wed Sep 18 07:20:31 CEST 2002


loewis at informatik.hu-berlin.de (Martin v. Löwis) writes:
>At the moment, you need CVS Python, and VC.NET, to get IPv6 suport on
>Windows. This then works both with the released XP, and the MS
>research IPv6 stack.

	Thanks.

>> 	What is the recommended method of finding out if Python and
>> 	the underlying OS support IPv6? I can, for instance, create an
>> 	IPv6 socket with a Python version that does *not* support
>> 	IPv6.

>What system is this? If you can create an IPv6 socket, why does it not
>support IPv6 (i.e. how do you know it does not support IPv6)? If you
>do .listen(), .getsockname() on that socket, what does it tell you?

	I have Redhat 7.3. The prepackaged RPMs have disabled IPv6, but
	the underlying OS supports it. So, this is what happens with the
	bind() system call, for instance:

Python 2.2.1 (#1, Jul 15 2002, 10:55:56) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket as so
>>> s = so.socket(so.AF_INET6, so.SOCK_DGRAM)
>>> s.bind(("", 0))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
socket.error: getsockaddrarg: bad family
>>> 

	So AF_INET6 is there, and I can create a socket, but everything
	dealing with addresses fails. 

						Pekka



More information about the Python-list mailing list