Bagikan melalui


Dns.GetHostByName(String) Metode

Definisi

Perhatian

GetHostByName has been deprecated. Use GetHostEntry instead.

Perhatian

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

Perhatian

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

Mendapatkan informasi DNS untuk nama host DNS yang ditentukan.

public:
 static System::Net::IPHostEntry ^ GetHostByName(System::String ^ hostName);
[System.Obsolete("GetHostByName has been deprecated. Use GetHostEntry instead.")]
public static System.Net.IPHostEntry GetHostByName(string hostName);
[System.Obsolete("GetHostByName is obsoleted for this type, please use GetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.IPHostEntry GetHostByName(string hostName);
[System.Obsolete("GetHostByName is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.IPHostEntry GetHostByName(string hostName);
public static System.Net.IPHostEntry GetHostByName(string hostName);
[<System.Obsolete("GetHostByName has been deprecated. Use GetHostEntry instead.")>]
static member GetHostByName : string -> System.Net.IPHostEntry
[<System.Obsolete("GetHostByName is obsoleted for this type, please use GetHostEntry instead. https://go.microsoft.com/fwlink/?linkid=14202")>]
static member GetHostByName : string -> System.Net.IPHostEntry
[<System.Obsolete("GetHostByName is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202")>]
static member GetHostByName : string -> System.Net.IPHostEntry
static member GetHostByName : string -> System.Net.IPHostEntry
Public Shared Function GetHostByName (hostName As String) As IPHostEntry

Parameter

hostName
String

Nama DNS host.

Mengembalikan

Objek IPHostEntry yang berisi informasi host untuk alamat yang ditentukan dalam hostName.

Atribut

Pengecualian

hostName adalah null.

Panjangnya hostName lebih besar dari 255 karakter.

Terjadi kesalahan saat menyelesaikan hostName.

Keterangan

Metode ini GetHostByName meminta server DNS Internet untuk informasi host. Jika Anda meneruskan string kosong sebagai nama host, metode ini mengambil nama host standar untuk komputer lokal.

Untuk akses asinkron ke informasi DNS, gunakan BeginGetHostByName metode dan EndGetHostByName .

Ipv6Element.Enabled Jika properti diatur ke true, Aliases properti instans yang IPHostEntry dikembalikan tidak diisi oleh metode ini dan akan selalu kosong.

Nota

Anggota ini memancarkan informasi pelacakan saat Anda mengaktifkan pelacakan jaringan di aplikasi Anda. Untuk informasi selengkapnya, lihat Pelacakan Jaringan di .NET Framework.

Berlaku untuk