IP Address Parser

In this chapter you will learn:

  1. Create(parse) IP address from string

Create IP address from String

The IPAddress class in the System.Net namespace represents an address in protocol.

It has a constructor accepting a byte array, and a static Parse method accepting a correctly formatted string:

using System;/*from  j a va2 s  .c o  m*/
using System.Net;

class MainClass
{
    public static void Main()
    {
        IPAddress test1 = IPAddress.Parse("192.168.1.1");

        Console.WriteLine(test1);
    }
}

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. What is the Loopback IP Address
  2. What is the Broadcast IP Address
  3. What is Any IP Address
  4. What is the None IP Address
Home » C# Tutorial » Network
Cookie
CredentialCache
HostEntry
IPHostEntry
IP address from host name
IPEndPoint from IPAddress
IPEndPoint Port
IPEndPoint properties
IPHostEntry
IP Address Parser
Predefined IP Address
NetworkCredential
Ping
Udp Client
Socket connection
Socket creation
Socket sendTo
TcpClient
TcpListener
UdpClient Receive
UdpClient Sending
Uri
WebClient
Response Headers
WebProxy
WebRequest