Message6407
First off, as mentioned in a previous message, the _use_ipv4_addresses_only(False) only affects return values from the getaddrinfo() function.
Therefore, if you want to use IPV6 addresses, the best code would look like this.
>>> import socket
>>> socket._use_ipv4_addresses_only(False) # Not necessary, this is the default
>>> address = socket.getaddrinfo("localhost", 9999, socket.AF_INET6)[0][4]
>>> address
('0:0:0:0:0:0:0:1', 9999, 0, 0)
>>> sock=socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
>>> sock.connect(address)
The address actually being used in your code sample, i.e. what is used internally by the conect() call, can be illustrated as follows
>>> import socket
>>> address = socket._get_jsockaddr( ("::1", 9999) )
>>> type(address)
<type 'java.net.InetSocketAddress'>
>>> address
/0:0:0:0:0:0:0:1:9999
>>> sock=socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
>>> sock.connect(address) |
|
Date |
User |
Action |
Args |
2011-02-26 20:35:10 | amak | set | messageid: <1298752510.9.0.612375540451.issue1711@psf.upfronthosting.co.za> |
2011-02-26 20:35:10 | amak | set | recipients:
+ amak, xjyvb3 |
2011-02-26 20:35:10 | amak | link | issue1711 messages |
2011-02-26 20:35:10 | amak | create | |
|