Possible Duplicate:
Get the IP Address of local computer
Obtaining local IP address using getaddrinfo() C function?
I need to account for IPs other than 127.0.0.1, and implementation should also detect hosts file entries or other methods.
Is there any way/api/function to directly check if a particular host resolves to the local machine?
Depends on the OS. But you enumerate IP interfaces, check what IP each is configured for, then you can compare IP addresses against your list of local IPs.
To do this on host names you will need to resolve host names to IPs using DNS, and then check against local IP interfaces as above.
I don’t know of any OS functions that just do this for you.