
If IPAddress.IsLoopback(address) And address.AddressFamily = AddressFamily.InterNetwork Then LoopBack = " is an IPv6 loopback address " + "whose internal format is: " + address.ToString() + "." If IPAddress.IsLoopback(address) And address.AddressFamily = AddressFamily.InterNetworkV6 Then ' Perform semantic check by verifying that the address is a valid IPv4

' Perform syntax check by parsing the address string entered by the user.ĭim address As IPAddress = IPAddress.Parse(ipAdd) Private Shared Sub parse(ipAdd As String)ĭim loopBack As String = " is not a loopback address." ' Then it checks whether it represents a loopback address. ' passed ipAddress parameter is in the correct format. ' This method calls the IPAddress.Parse method to check whether the ' Parse the address string entered by the user. Display program usage.Ĭonsole.WriteLine("Please enter an IP address.")Ĭonsole.WriteLine("Usage: >ipaddress_isloopback any IPv4 or IPv6 address.")Ĭonsole.WriteLine("Example: >ipaddress_isloopback 127.0.0.1")Ĭonsole.WriteLine("Example: >ipaddress_isloopback 0:0:0:0:0:0:0:1") Overloads Private Shared Sub Main(args() As String) 'Entry point which delegates to C-style main Private Function LoopBack = " is an IPv4 loopback address " +Ĭonsole.WriteLine("Your input address: " + "\"" + ipAddress + "\"" + loopBack) Ĭonsole.WriteLine("FormatException caught!!!") Ĭonsole.WriteLine("Source : " + e.Source) Ĭonsole.WriteLine("Message : " + e.Message) Ĭonsole.WriteLine("Exception caught!!!") If(IPAddress.IsLoopback(address) & address.AddressFamily = AddressFamily.InterNetwork) "whose internal format is: " + address.ToString() + "." LoopBack = " is an IPv6 loopback address " + If(IPAddress.IsLoopback(address)& address.AddressFamily = AddressFamily.InterNetworkV6) IPAddress address = IPAddress.Parse(ipAddress) String loopBack=" is not a loopback address."

Private static void parse(string ipAddress) This method calls the IPAddress.Parse method to check if the Parse the address string entered by the user.Ĭonsole.WriteLine("Please enter an IP address.") Ĭonsole.WriteLine("Usage: >ipaddress_isloopback any IPv4 or IPv6 address.") Ĭonsole.WriteLine("Example: >ipaddress_isloopback 127.0.0.1") Ĭonsole.WriteLine("Example: >ipaddress_isloopback 0:0:0:0:0:0:0:1") Display program usage.Ĭonsole::WriteLine( "Please enter an IP address." ) Ĭonsole::WriteLine( "Usage: >ipaddress_isloopback any IPv4 or IPv6 address." ) Ĭonsole::WriteLine( "Example: >ipaddress_isloopback 127.0.0.1" ) Ĭonsole::WriteLine( "Example: >ipaddress_isloopback 0:0:0:0:0:0:0:1" ) LoopBack = String::Concat( " is an IPv4 loopback address whose internal format is: ", address, "." ) Ĭonsole::WriteLine( "Your input address: \" ", e->Message ) Īrray^args = Environment::GetCommandLineArgs() If ( IPAddress::IsLoopback( address ) & address->AddressFamily = AddressFamily::InterNetwork ) LoopBack = String::Concat( " is an IPv6 loopback address whose internal format is: ", address, "." ) If ( IPAddress::IsLoopback( address ) & address->AddressFamily = AddressFamily::InterNetworkV6 ) Perform semantic check by verifying that the address is a valid IPv4 IPAddress^ address = IPAddress::Parse( ipAddress ) Perform syntax check by parsing the address string entered by the user.

String^ loopBack = " is not a loopback address." Then it checks whether it represents a loopback address. passed ipAddress parameter is in the correct format. This method calls the IPAddress::Parse method to check if the
#IPV6 LOOPBACK CODE#
The following code example uses the IsLoopback method to determine whether the specified address is a loopback address. True if address is the loopback address otherwise, false.
