So when its an IP Address you actually want to do a DNS lookup???

I think you need to look at this code a little more