Sometimes you may have a reason to figure our the IP for a domain name or vice versa the name for an IP. Lookup up the name for an IP often helps to identify the IP address because the hostname you get may include the domain of the provider or company.
To do a lookup, you can use the two functions DNSLookup.LookupHostByAddress or DNSLookup.LookupHostByName. First one takes the IP, second the domain name. Both start a lookup and give back a reference number. Why? Because we get back a domain name, several IPs and several alias addresses.
So you can query the name of the record you got via DNSLookup.Name, the addresses with DNSLookup.AddressCount and DNSLookup.Address, the alias names with DNSLookup.AliasCount and DNSLookup.Alias and later release the whole data set with DNSLookup.Release function. For example lookup up apple.com from my office gives three IPs: 220.127.116.11, 18.104.22.168 and 22.214.171.124. But looking up www.apple.com gives just one 126.96.36.199. The record name is e6858.dscc.akamaiedge.net so Apple actually uses Akamai here for content distribution. The IP also has aliases listed as www.apple.com, www.apple.com.edgekey.net and www.apple.com.edgekey.net.globalredir.akadns.net.
We hope you find those IP lookup functions helpful and use them someday.