Establishing an IPv6 connection using sockets in python

I am trying to run this very basic socket example:

import socket
host = 'ipv6hostnamegoeshere'
port=9091

ourSocket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
ourSocket.connect((host, port))

Yet, I get the error:

    ourSocket.connect((host, port))
  File "<string>", line 1, in connect
socket.error: [Errno 22] Invalid argument

The boolean has_ipv6 returns true. Any help?

8
задан collisionTwo 18 March 2011 в 21:28
поделиться