186d7f5d3SJohn MarinoThis is a simple program which demonstrates how to query the kernel 286d7f5d3SJohn Marinorouting mechanism using only a UDP socket. Pass it a hostname on 386d7f5d3SJohn Marinothe command line (sorry, it doesn't parse dotted decimal) and it will 486d7f5d3SJohn Marinoprint out an IP address which names the interface over which UDP 586d7f5d3SJohn Marinopackets intended for that destination would be sent. 686d7f5d3SJohn MarinoA more sophisticated program might use the list obtained from SIOCGIFCONF 786d7f5d3SJohn Marinoto match the address with an interface name, but applications programmers 886d7f5d3SJohn Marinomuch more often need to know the address of the interface rather than 986d7f5d3SJohn Marinothe name. 10