C#. Common methods and descriptions of DNS classes in net

Source: Internet
Author: User

IP is a common application of the Internet, allowing different hosts to find each other's addressing protocol. The IP address consists of a number of 4 decimal digits, the value of each number is between 0~255, although it solves the problem of computer identification on the network, but the IP address is not easy to remember, so the domain Name System (DNS) was developed, it is specifically used to translate the IP address into meaningful text, To facilitate the identification of memory.

The. Net Framework class library has built-in problems with the related classes for handling IP addresses, which are under the System.Net namespace. The DNS classes are described in detail here. Common methods and descriptions in DNS classes are shown in the table.

Common methods and descriptions of table DNS classes

Name Description
Begingethostaddresses Returns an Internet Protocol (IP) address for a specified host asynchronously
Begingethostbyname Starts an asynchronous request for iphostentry information about the specified DNS host name
Begingethostentry has been overloaded. Asynchronously resolves a host name or IP address to a iphostentry instance
Beginresolve Begins an asynchronous request to resolve a DNS host name or IP address to a IPAddress instance
Endgethostaddresses Ending an asynchronous request for DNS information
Endgethostbyname Ending an asynchronous request for DNS information
Endgethostentry Ending an asynchronous request for DNS information
Endresolve Ending an asynchronous request for DNS information
Gethostaddresses Returns the Internet Protocol (IP) address of the specified host
Gethostbyaddress has been overloaded. Obtaining DNS host information for an IP address
gethostbyname Gets DNS information for the specified DNS host name
GetHostName Get the host name of the local computer
GetType Gets the type of the current instance
Gethostentry has been overloaded. Resolves a host name or IP address to a iphostentry instance
Resolve Resolve DNS host name or IP address to iphostentry instance

The following is a detailed introduction to the more important methods.

(1) Gethostaddresses method

Returns the Internet Protocol (IP) address of the specified host.

Grammar:

public static IPAddress[] GetHostAddresses (
string hostNameOrAddress
)

Parameters:

hostNameOrAddress: The host name or IP address to resolve.

Return value: An array of IPAddress types that holds the IP address of the host specified by the hostNameOrAddress parameter.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.