Current Path : /compat/linux/proc/68247/cwd/usr/src/share/examples/find_interface/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/68247/cwd/usr/src/share/examples/find_interface/README |
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.