Subject: Re: PF_UNIX in getaddrinfo(3)
To: None <>
From: Mario Kemper <>
List: tech-net
Date: 02/17/2002 18:05:41
Ignatios Souvatzis <> writes:

> It certainly is an interesting approach to use getaddrinfo() (or the old
> gethostname()) to resolve an AF_UNIX name (which is just a filename that 
> happens to point to a socket) - all it can do is return an addrinfo structure
> containing a pointer to the unchanged name, copy the socket type from the 
> hints and set the address family to AF_UNIX.

I know, i wrote a little wrapper for this.
It's just that Linux seems to do it within getaddrinfo. So i was curious
if we're missing something.
> Hm, how does it guess that the address familiy is AF_UNIX if you don't tell
> it that in the hints? You don't know the socket is there until you try to open
> it...

I suppose it will only work when you tell it.
> As a workaround, you can easily pass those three values to the socket()
> and the connect() etc. calls yourself. Should be about 5 lines of code.
> I can see that you can keep codesize a bit smaller in applications like
> yours - 
I just want to change as less as possible in a package and try to convince 
the author to write it portable.
Mario Kemper