Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
VB.Net: Determining if an IPAddress is IPv4 or IPv6
From Wiki
This can be really simple
- Imports System.IO
- Module Module1
- Sub Main()
- Dim _IPAddress As System.Net.IPAddress
- _IPAddress = New System.Net.IPAddress(New Byte() {125, 23, 23, 4})
- Console.WriteLine(_IPAddress.ToString)
- Console.WriteLine([Enum].GetName(GetType(System.Net.Sockets.AddressFamily), _IPAddress.AddressFamily)) 'ipv4
- _IPAddress = New System.Net.IPAddress(New Byte() {125, 23, 23, 4, 125, 23, 23, 4, 125, 23, 23, 4, 125, 23, 23, 4})
- Console.WriteLine(_IPAddress.ToString)
- Console.WriteLine([Enum].GetName(GetType(System.Net.Sockets.AddressFamily), _IPAddress.AddressFamily)) 'ipv6
- Console.ReadLine()
- End Sub
- End Module
Well perhaps not so simple.
This was the result in the console
125.23.2.4 InterNetwork 7d17:1704:7d17:1704:7d17:1704:125.23.23.4 InterNetworkv6
A bit of a weird stringoutput for version 6 but you get the picture.



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.