freebsd-dev/share/examples/find_interface
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
..
find_interface.c Make the long-awaited change from $Id$ to $FreeBSD$ 1997-01-14 07:20:47 +00:00
Makefile Make the long-awaited change from $Id$ to $FreeBSD$ 1997-01-14 07:20:47 +00:00
README Added a copy of my little program to find the IP address of the outgoing 1995-08-14 16:08:39 +00:00

This is a simple program which demonstrates how to query the kernel
routing mechanism using only a UDP socket.  Pass it a hostname on
the command line (sorry, it doesn't parse dotted decimal) and it will
print out an IP address which names the interface over which UDP
packets intended for that destination would be sent.
A more sophisticated program might use the list obtained from SIOCGIFCONF
to match the address with an interface name, but applications programmers
much more often need to know the address of the interface rather than
the name.