Fix for bug #347

This is my first time contributing, I'm not sure how to use Linq, this is just a googled' method of getting the IPv4's out of the array.

I also moved tryParse before the Dns lookup, it seems more logical this way as tryParse is local.

Obviously reject the merge if something is flawed.

Testing this code makes "localhost" and "mygen.ca" work for me.