My understanding is that .NET (v3.5 to 4.5.2, in my testing) will return IPv6 addresses with two colons, like this -
Dim host As String = Dns.GetHostName()
Dim ip As IPHostEntry = Dns.GetHostEntry(host)
Console.WriteLine(ip.AddressList(0).ToString())
Console.ReadKey()
which outputs fe80::2d36:51be:16dc:257b%36 in my situation, a wireless connection through a gateway to an ADSL modem.
My interest in your problem is that I would like to return the IPv4 address, which I know to be 203.214.36.136 (until I reset the modem). I can see that by logging into my ISP, or by using code like this -
Using client = New WebClient()
Dim ret As String = client.DownloadString("http://icanhazip.com/").Trim()
Console.WriteLine(ret)
Console.ReadKey()
client.Dispose()
End Using
The web page used will return an IPv4 IP address (which I can verify is correct by both logging into my ADSL modem, and into my ISP's webpage). I'm not sure what code on the page redirects to return the IP address (I copied this from a SO answer also dealing with IP addressing).
Trying your code for which uses .MaptoIPv4 (of course I used VS2012 or 2013, with .NET v4.5) I also used a null value for ipv4 (your variable), but the string value returned from my first code block above, for your variable strIP.
It failed.
I'm still trying to nut out just how these methods should be used.
[edit] Actually, I'm wrong in assuming the first IP address in the host AddressList is the one I want. There are 3, 2 of them IPv6, and one IPv4 which is the gateway to my modem.
So I haven't contributed much to the solution. Sorry.