xref: /freebsd-src/share/examples/find_interface/README (revision 0699090b6a4116e3cc55b20d33548f9866c5ff1d)
1*0699090bSGarrett WollmanThis is a simple program which demonstrates how to query the kernel
2*0699090bSGarrett Wollmanrouting mechanism using only a UDP socket.  Pass it a hostname on
3*0699090bSGarrett Wollmanthe command line (sorry, it doesn't parse dotted decimal) and it will
4*0699090bSGarrett Wollmanprint out an IP address which names the interface over which UDP
5*0699090bSGarrett Wollmanpackets intended for that destination would be sent.
6*0699090bSGarrett WollmanA more sophisticated program might use the list obtained from SIOCGIFCONF
7*0699090bSGarrett Wollmanto match the address with an interface name, but applications programmers
8*0699090bSGarrett Wollmanmuch more often need to know the address of the interface rather than
9*0699090bSGarrett Wollmanthe name.
10