This information is supplied for understanding common uses and differences between Address Classes in .NET:

class IPAddress:

Has 1 Property: long Address {get,set}, for the IP It contains.
If wanting to get the IP Address it caontains as a dotted-quad format, Don't use the .Address property, and instead do
IP1.ToString(), where IP1 is an Object of the IPAddress class.

Examples of Use:
1: IPAddress IP1=IPAddress.Parse("192.168.1.2");
2: IPAddress IP1=Dns.Resolve(www.microsoft.com).AddressList[0];

 

IPEndPoint:

Has 2 Properties:
- IPAddress  Address    //An IP. Cannot contain a Hostname(like "user10.microsoft.com")
- int              Port

 

IPHostEntry:

Has 3 Properties(all are {get,set}):
- IPAddress[]   AddressList             //IP Addresses Associated with a Host
- string[]           Aliases                  //DNS Names That Resolve to the IP Addresses in the AddressList Property
- string             HostName              //The Primary HostName for the Server

This class is Used as a Helper Class With the Dns Class.
Example of Use:
IPHostEntry H=Dns.GetHostByName("microsoft.com");

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish