getaddrinfo weirdness

Jp Calderone exarkun at intarweb.us
Fri Feb 14 21:06:38 CET 2003


On Sat, Feb 15, 2003 at 01:53:39AM +0800, Trent Lloyd wrote:
> Hi,
> 
>         Trying to use getaddrinfo to get listening addresses
> --
> import socket
> print socket.getaddrinfo(None, "ircd",socket.AF_UNSPEC , 
> socket.SOCK_STREAM, 0)
> --
> which yields the same result as
> --
> import socket
> print socket.getaddrinfo(None, "ircd")
> --
> seven:~/gravity> python test.py
> [(10, 1, 6, '', ('::1', 6667, 0, 0)), (2, 1, 6, '', ('127.0.0.1', 6667))]
> 
> 
> Technically this should return all listerning interfaces and therefore i 
> suspect perhaps :: and others.
> 

  Without the AI_PASSIVE hint being specified, the above behavior is
correct.  To find the values I believe you are looking for, try:

    from socket import *
    getaddrinfo(None, 'ircd', AF_UNSPEC, SOCK_STREAM, 0, AI_PASSIVE)

  Jp

-- 
 up 6 days, 0:29, 5 users, load average: 0.00, 0.00, 0.00
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030214/134484d9/attachment.pgp>


More information about the Python-list mailing list