Subject: Re: does getaddrinfo() behave correctly?
To: None <tech-userlevel@netbsd.org>
From: Michael van Elst <mlelstv@serpens.de>
List: tech-userlevel
Date: 09/15/2007 23:46:45
k.heinz.sep.sieben@kh-22.de (Klaus Heinz) writes:

>in the course of building a package I discovered this (IMO) strange
>behaviour of getaddrinfo() concerning port numbers:

>This does not:
>  $ ./test-getaddrinfo localhost 25  
>  result: 9 = servname not supported for ai_socktype


There is no way for getaddrinfo() to deduce a protocol
from just a port number.

Giving it a hint that you want data for a SOCK_STREAM is
enough and you get:

result: 0 = Success
flags: 0, family: 24, socktype: 1, protocol: 6

-- 
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."