10699090bSGarrett WollmanThis is a simple program which demonstrates how to query the kernel 20699090bSGarrett Wollmanrouting mechanism using only a UDP socket. Pass it a hostname on 30699090bSGarrett Wollmanthe command line (sorry, it doesn't parse dotted decimal) and it will 40699090bSGarrett Wollmanprint out an IP address which names the interface over which UDP 50699090bSGarrett Wollmanpackets intended for that destination would be sent. 60699090bSGarrett WollmanA more sophisticated program might use the list obtained from SIOCGIFCONF 70699090bSGarrett Wollmanto match the address with an interface name, but applications programmers 80699090bSGarrett Wollmanmuch more often need to know the address of the interface rather than 90699090bSGarrett Wollmanthe name. 10