Dns.GetHostAddressesAsync Metodo

Definizione

Overload

GetHostAddressesAsync(String, AddressFamily, CancellationToken)

Restituisce gli indirizzi IP (Internet Protocol) per l'host specificato come operazione asincrona.

GetHostAddressesAsync(String, CancellationToken)

Restituisce gli indirizzi IP (Internet Protocol) per l'host specificato come operazione asincrona.

GetHostAddressesAsync(String)

Restituisce gli indirizzi IP (Internet Protocol) per l'host specificato come operazione asincrona.

GetHostAddressesAsync(String, AddressFamily, CancellationToken)

Source:
Dns.cs
Source:
Dns.cs
Source:
Dns.cs

Restituisce gli indirizzi IP (Internet Protocol) per l'host specificato come operazione asincrona.

public static System.Threading.Tasks.Task<System.Net.IPAddress[]> GetHostAddressesAsync (string hostNameOrAddress, System.Net.Sockets.AddressFamily family, System.Threading.CancellationToken cancellationToken = default);
static member GetHostAddressesAsync : string * System.Net.Sockets.AddressFamily * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.IPAddress[]>
Public Shared Function GetHostAddressesAsync (hostNameOrAddress As String, family As AddressFamily, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IPAddress())

Parametri

hostNameOrAddress
String

Nome dell'host o indirizzo IP da risolvere.

family
AddressFamily

Famiglia di indirizzi per cui è necessario recuperare gli INDIRIZZI IP. Se Unspecified, recuperare tutti gli INDIRIZZI IP indipendentemente dalla famiglia di indirizzi.

cancellationToken
CancellationToken

Token di annullamento che può essere usato per segnalare che l'operazione asincrona deve essere annullata.

Restituisce

Oggetto dell'attività che rappresenta l'operazione asincrona. La proprietà Result nell'oggetto attività restituisce una matrice di tipo IPAddress che contiene gli indirizzi IP per l'host che è specificato dal parametro hostNameOrAddress.

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Commenti

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da GetHostAddresses(String, AddressFamily).

Si applica a

GetHostAddressesAsync(String, CancellationToken)

Source:
Dns.cs
Source:
Dns.cs
Source:
Dns.cs

Restituisce gli indirizzi IP (Internet Protocol) per l'host specificato come operazione asincrona.

public:
 static System::Threading::Tasks::Task<cli::array <System::Net::IPAddress ^> ^> ^ GetHostAddressesAsync(System::String ^ hostNameOrAddress, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Net.IPAddress[]> GetHostAddressesAsync (string hostNameOrAddress, System.Threading.CancellationToken cancellationToken);
static member GetHostAddressesAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.IPAddress[]>
Public Shared Function GetHostAddressesAsync (hostNameOrAddress As String, cancellationToken As CancellationToken) As Task(Of IPAddress())

Parametri

hostNameOrAddress
String

Nome dell'host o indirizzo IP da risolvere.

cancellationToken
CancellationToken

Token di annullamento che può essere usato per segnalare che l'operazione asincrona deve essere annullata.

Restituisce

Oggetto dell'attività che rappresenta l'operazione asincrona. La proprietà Result nell'oggetto attività restituisce una matrice di tipo IPAddress che contiene gli indirizzi IP per l'host che è specificato dal parametro hostNameOrAddress.

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Commenti

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da GetHostAddresses(String).

Si applica a

GetHostAddressesAsync(String)

Source:
Dns.cs
Source:
Dns.cs
Source:
Dns.cs

Restituisce gli indirizzi IP (Internet Protocol) per l'host specificato come operazione asincrona.

public:
 static System::Threading::Tasks::Task<cli::array <System::Net::IPAddress ^> ^> ^ GetHostAddressesAsync(System::String ^ hostNameOrAddress);
public static System.Threading.Tasks.Task<System.Net.IPAddress[]> GetHostAddressesAsync (string hostNameOrAddress);
static member GetHostAddressesAsync : string -> System.Threading.Tasks.Task<System.Net.IPAddress[]>
Public Shared Function GetHostAddressesAsync (hostNameOrAddress As String) As Task(Of IPAddress())

Parametri

hostNameOrAddress
String

Nome dell'host o indirizzo IP da risolvere.

Restituisce

Oggetto dell'attività che rappresenta l'operazione asincrona. La proprietà Result nell'oggetto attività restituisce una matrice di tipo IPAddress che contiene gli indirizzi IP per l'host che è specificato dal parametro hostNameOrAddress.

Eccezioni

hostNameOrAddress è null.

La lunghezza del parametro hostNameOrAddress è maggiore di 255 caratteri.

Si è verificato un errore durante la risoluzione del parametro hostNameOrAddress.

hostNameOrAddress è un indirizzo IP non valido.

Commenti

Questa operazione non verrà bloccata. L'oggetto restituito Task<TResult> verrà completato dopo la hostNameOrAddress risoluzione.

Questo metodo esegue una query su un server DNS per gli indirizzi IP associati a un nome host. Se hostNameOrAddress è un indirizzo IP, questo indirizzo viene restituito senza eseguire query sul server DNS.

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da GetHostAddresses(String).

Si applica a