[Python-bugs-list] [ python-Bugs-618608 ] getaddrinfo and numeric ports
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 05 Oct 2002 03:06:30 -0700
Bugs item #618608, was opened at 2002-10-04 17:33
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=618608&group_id=5470
Category: Extension Modules
Group: Python 2.2.2
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Jesús Cea Avión (jcea)
Assigned to: Nobody/Anonymous (nobody)
Summary: getaddrinfo and numeric ports
Initial Comment:
Python 2.2.1 here.
Documentación for "socket.getaddrinfo()" says that
"port" can be "a string service name (like ``http''), a
numeric port number or None.".
String service name and "None" work fine. But numeric
ports are not soported under LINUX RedHat:
>>> socket.getaddrinfo("localhost",80)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
socket.gaierror: (-8, 'Servname not supported for
ai_socktype')
It works fine under Solaris 2.5.1 and Win98.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2002-10-05 12:06
Message:
Logged In: YES
user_id=21627
You have to provide a socket type if you want to specify a
port number; without a socket type (SOCK_STREAM or
SOCK_DGRAM), the port number is meaningless.
So the proper call is
socket.getaddrinfo("localhost",80,0,socket.SOCK_STREAM)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=618608&group_id=5470