英語で読む

次の方法で共有


Dns.GetHostByAddress メソッド

定義

IP アドレスの DNS ホスト情報を取得します。 これらのメソッドは今後使用しません。

オーバーロード

GetHostByAddress(IPAddress)
古い.
古い.
古い.

指定した IPHostEntry に対する IPAddress インスタンスを作成します。

GetHostByAddress(String)
古い.
古い.
古い.

IP アドレスから IPHostEntry インスタンスを作成します。

GetHostByAddress(IPAddress)

ソース:
Dns.cs
ソース:
Dns.cs
ソース:
Dns.cs

注意事項

GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202

注意事項

GetHostByAddress has been deprecated. Use GetHostEntry instead.

注意事項

GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202

指定した IPHostEntry に対する IPAddress インスタンスを作成します。

[System.Obsolete("GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.IPHostEntry GetHostByAddress (System.Net.IPAddress address);
[System.Obsolete("GetHostByAddress has been deprecated. Use GetHostEntry instead.")]
public static System.Net.IPHostEntry GetHostByAddress (System.Net.IPAddress address);
[System.Obsolete("GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.IPHostEntry GetHostByAddress (System.Net.IPAddress address);
public static System.Net.IPHostEntry GetHostByAddress (System.Net.IPAddress address);

パラメーター

address
IPAddress

IPAddress

戻り値

IPHostEntry のインスタンス。

属性

例外

addressnullです。

address を解決するときにエラーが発生しました。

次の例では、 から を IPHostEntry 作成します IPAddress

 try
 {
    IPAddress hostIPAddress = IPAddress.Parse(IpAddressString);
    IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
    // Get the IP address list that resolves to the host names contained in
    // the Alias property.
    IPAddress[] address = hostInfo.AddressList;
    // Get the alias names of the addresses in the IP address list.
    String[] alias = hostInfo.Aliases;

    Console.WriteLine("Host name : " + hostInfo.HostName);
    Console.WriteLine("\nAliases :");
    for(int index=0; index < alias.Length; index++) {
      Console.WriteLine(alias[index]);
    }
    Console.WriteLine("\nIP address list : ");
    for(int index=0; index < address.Length; index++) {
       Console.WriteLine(address[index]);
    }
 }
 catch(SocketException e)
 {
Console.WriteLine("SocketException caught!!!");
    Console.WriteLine("Source : " + e.Source);
    Console.WriteLine("Message : " + e.Message);
 }
 catch(FormatException e)
 {
Console.WriteLine("FormatException caught!!!");
    Console.WriteLine("Source : " + e.Source);
    Console.WriteLine("Message : " + e.Message);
 }
 catch(ArgumentNullException e)
 {
Console.WriteLine("ArgumentNullException caught!!!");
    Console.WriteLine("Source : " + e.Source);
    Console.WriteLine("Message : " + e.Message);
 }
 catch(Exception e)
 {
     Console.WriteLine("Exception caught!!!");
     Console.WriteLine("Source : " + e.Source);
     Console.WriteLine("Message : " + e.Message);
 }

注釈

注意

このメンバーは、アプリケーションでネットワーク トレースを有効にすると、トレース情報を出力します。 詳細については、「 .NET Framework でのネットワーク トレース」を参照してください。

適用対象

.NET 9 およびその他のバージョン
製品 バージョン (廃止)
.NET (Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9)
.NET Framework 1.1 (2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1)
.NET Standard (2.0, 2.1)

GetHostByAddress(String)

ソース:
Dns.cs
ソース:
Dns.cs
ソース:
Dns.cs

注意事項

GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202

注意事項

GetHostByAddress has been deprecated. Use GetHostEntry instead.

注意事項

GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202

IP アドレスから IPHostEntry インスタンスを作成します。

[System.Obsolete("GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.IPHostEntry GetHostByAddress (string address);
[System.Obsolete("GetHostByAddress has been deprecated. Use GetHostEntry instead.")]
public static System.Net.IPHostEntry GetHostByAddress (string address);
[System.Obsolete("GetHostByAddress is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.IPHostEntry GetHostByAddress (string address);
public static System.Net.IPHostEntry GetHostByAddress (string address);

パラメーター

address
String

IP アドレス。

戻り値

IPHostEntry のインスタンス。

属性

例外

addressnullです。

address を解決するときにエラーが発生しました。

address が有効な IP アドレスではありません。

注釈

注意

このメンバーは、アプリケーションでネットワーク トレースを有効にすると、トレース情報を出力します。 詳細については、「 .NET Framework でのネットワーク トレース」を参照してください。

適用対象

.NET 9 およびその他のバージョン
製品 バージョン (廃止)
.NET (Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9)
.NET Framework 1.1 (2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1)
.NET Standard (2.0, 2.1)