Title: socket.getsockname() returns 2-tuple instead of 4-tuple for ipv6 sockets
Type: Severity: normal
Components: Core Versions: Jython 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, irmen, zyasoft
Priority: Keywords:

Created on 2013-08-26.16:00:35 by irmen, last changed 2014-05-22.00:01:12 by irmen.

msg8091 (view) Author: Irmen de Jong (irmen) Date: 2013-08-26.16:00:35
socket.getsockname() returns a 2-tuple address (ipv4-address) instead of a 4-tuple ipv6 address, for ipv6 sockets:

>>> from socket import *
>>> s=socket(AF_INET6, SOCK_STREAM)
>>> s.bind(("",0,0,0))
>>> s.listen(1)
>>> s.getsockname()
(u'0:0:0:0:0:0:0:0', 58578)

Expected result:  a 4-tuple (proper ipv6 address)
msg8106 (view) Author: Alan Kennedy (amak) Date: 2013-09-07.13:45:19
Hi Irmen.

I am not able to reproduce this on my local setup.

What version of jython is this happening on?
What java version?
What operating system?
msg8108 (view) Author: Irmen de Jong (irmen) Date: 2013-09-08.13:29:26
Happens with jython trunk (2.7b1+).
Happens on Windows 7 (java 1.7) and OS X 10.8.4 (java 1.6).
Both machines have a functional IPV6 (and IPV4) network address assigned.
msg8478 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.21:27:48
Pretty much the same issue as #2078, so I'm going to mark as a duplicate to reduce noise here.
msg8511 (view) Author: Irmen de Jong (irmen) Date: 2014-05-22.00:01:12
I disagree with marking this as a duplicate because the issue here has to do with the format of the socket address in case of ipv6. Not with the wrong ip address being returned for ipv4 sockets (which #2078 is about)

This issue is about ipv6 sockets that should have a 4-tuple as address, not the regular 2-tuple that is used for ipv4 addresses: "For AF_INET6 address family, a four-tuple (host, port, flowinfo, scopeid) is used".
Date User Action Args
2014-05-22 00:01:12irmensetmessages: + msg8511
2014-05-21 21:27:48zyasoftsetstatus: open -> closed
resolution: duplicate
messages: + msg8478
nosy: + zyasoft
2013-09-08 13:29:27irmensetmessages: + msg8108
2013-09-07 13:45:19amaksetassignee: amak
messages: + msg8106
nosy: + amak
2013-08-26 16:00:35irmencreate