Issue1051

classification
Title: socket does not define AF_UNSPEC and AI_PASSIVE constants
Type: Severity: major
Components: Library Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, billiejoex
Priority: normal Keywords:

Created on 2008-06-09.13:22:24 by billiejoex, last changed 2009-01-07.15:34:49 by amak.

Messages
msg3261 (view) Author: Giampaolo Rodola' (billiejoex) Date: 2008-06-09.13:22:19
It is often needed to build clients/servers that support both IPv4 and IPv6.
Example:

# Echo client program
import socket
import sys

HOST = 'daring.cwi.nl'    # The remote host
PORT = 50007              # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM):
    af, socktype, proto, canonname, sa = res
    try:
     s = socket.socket(af, socktype, proto)
    except socket.error, msg:
     s = None
     continue
    try:
     s.connect(sa)
    except socket.error, msg:
     s.close()
     s = None
     continue
    break
msg3268 (view) Author: Giampaolo Rodola' (billiejoex) Date: 2008-06-09.18:00:19
I noticed that also AI_PASSIVE is not available which is useful to build
IPv4/IPv6 independent servers.
msg3291 (view) Author: Alan Kennedy (amak) Date: 2008-06-19.13:00:48
Accepted that this is required for lookups that require both IPV4 and IPV6.

Fixing this bug will require a thorough review of the existing code, for
IPV6 compliance; a review which I will carry out soon.
msg4007 (view) Author: Alan Kennedy (amak) Date: 2009-01-07.15:34:49
These constants were added to the socket module in r4948.

More work will be necessary to support IPV6.
History
Date User Action Args
2009-01-07 15:34:49amaksetstatus: open -> closed
resolution: fixed
messages: + msg4007
2008-12-17 19:51:49fwierzbickisetpriority: normal
2008-06-19 13:00:49amaksetassignee: amak
messages: + msg3291
nosy: + amak
2008-06-09 18:00:25billiejoexsetmessages: + msg3268
severity: normal -> major
components: + Library
title: socket does not define AF_UNSPEC constant -> socket does not define AF_UNSPEC and AI_PASSIVE constants
2008-06-09 13:22:24billiejoexcreate