Lookup the IP address(es) for a host.
Namespace:
JHSoftwareAssembly: JHSoftware.DnsClient (in JHSoftware.DnsClient.dll) Version: 1.0.1.0 (1.0.1.0)
Syntax
| C# |
|---|
public static IPAddress[] LookupHost( string hostName ) |
| Visual Basic (Declaration) |
|---|
Public Shared Function LookupHost ( _ hostName As String _ ) As IPAddress() |
Parameters
- hostName
- Type: System..::.String
The host name to look up. IDNs may be either in native or encoded form (xn--...).
Return Value
The host's IPv4 address(es).
Remarks
This overload queries the DNS servers found in the local computer's IP configuration using default DNS request options (see remarks in properties of the DnsClient..::.RequestOptions object).
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentException | Invalid host name. |
| JHSoftware..::.DnsClient..::.NoDnsServersException | No DNS servers where specified, and no DNS servers could be found in this computer's IP configuration |
| JHSoftware..::.DnsClient..::.NXDomainException | The requested domain name does not exist (DNS server returned RCode 3 NXDomain). |
| JHSoftware..::.DnsClient..::.NoDataException | The requested domain name exists but has no records of the requested type. |
| JHSoftware..::.DnsClient..::.NoDefinitiveAnswerException | None of the DNS servers returned a definitive answer. |