Date: Thu, 31 Jan 2008 17:50:20 +0100 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: "Heiko Wundram \(Beenic\)" <wundram@beenic.net> Cc: freebsd-hackers@freebsd.org Subject: Re: OT: getting the protocol family of a file descriptor Message-ID: <86myqmvt0z.fsf@ds4.des.no> In-Reply-To: <200801311701.49792.wundram@beenic.net> (Heiko Wundram's message of "Thu\, 31 Jan 2008 17\:01\:49 %2B0100") References: <200801310923.16029.wundram@beenic.net> <86zlumvwob.fsf@ds4.des.no> <200801311701.49792.wundram@beenic.net>
next in thread | previous in thread | raw e-mail | index | archive | help
"Heiko Wundram (Beenic)" <wundram@beenic.net> writes: > Currently, you're basically required to do a getsockname to a struct > sockaddr_storage and typecast that to the actual socket addres type > based on the ss_family member (to be able to pass it to one of the > *_ntop-functions, for example), but generally, I don't find this too > beautiful. But, maybe, that's just my (horribly broken) taste. ;-) Uh, I'm pretty sure there's a function in the getaddr* family that will give you a string representation of any struct sockaddr. Actually, I'm absolutely sure of it: getnameinfo() with NI_NUMERICHOST|NI_NUMERICSERV will format the numerical address for you instead of looking it up in DNS. But what I really don't understand is this: you say you just want the address family so you'll know how to format the address. If you have the address, you already know the family. So what's the issue, really? DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86myqmvt0z.fsf>