OT: getting the protocol family of a file descriptor

Dag-Erling Smørgrav des at des.no
Thu Jan 31 07:31:42 PST 2008


"Heiko Wundram (Beenic)" <wundram at beenic.net> writes:
> I'm currently in the need to get the protocol family that was used to
> create a socket (and passed via a unix domain socket to another
> program), and I've not really come up with a proper scheme other than
> to use getsockname and retrieve sa_family from the resulting socket
> (which currently matches the socket domain and historically has, but
> why take the chances ;-)).

This is the correct way to do it, I don't understand why you think it
might not work in the future.

> Is there any other "better" way to get at the domain (protocol family)
> of a socket?

Why should there be a better way?

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-hackers mailing list