12public static class Dns
230 [
Obsolete(
"GetHostByName has been deprecated. Use GetHostEntry instead.")]
233 if (hostName ==
null)
244 [
Obsolete(
"BeginGetHostByName has been deprecated. Use BeginGetHostEntry instead.")]
250 [
Obsolete(
"EndGetHostByName has been deprecated. Use EndGetHostEntry instead.")]
256 [
Obsolete(
"GetHostByAddress has been deprecated. Use GetHostEntry instead.")]
271 [
Obsolete(
"GetHostByAddress has been deprecated. Use GetHostEntry instead.")]
286 [
Obsolete(
"Resolve has been deprecated. Use GetHostEntry instead.")]
289 if (hostName ==
null)
320 [
Obsolete(
"BeginResolve has been deprecated. Use BeginGetHostEntry instead.")]
326 [
Obsolete(
"EndResolve has been deprecated. Use EndGetHostEntry instead.")]
474 if (hostName ==
null)
585 iPHostEntry.HostName = address.
ToString();
586 iPHostEntry.Aliases =
Array.Empty<
string>();
587 iPHostEntry.AddressList =
new IPAddress[1] { address };
593 if (hostName.Length > 255 || (hostName.Length == 255 && hostName[254] !=
'.'))
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
static IAsyncResult BeginGetHostEntry(IPAddress address, AsyncCallback? requestCallback, object? stateObject)
static Task< IPAddress[]> GetHostAddressesAsync(string hostNameOrAddress)
static Task< IPHostEntry > GetHostEntryAsync(string hostNameOrAddress)
static IPHostEntry GetHostByName(string hostName)
static object GetHostEntryOrAddressesCore(string hostName, bool justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch)
static void ValidateHostName(string hostName)
static IPHostEntry EndResolve(IAsyncResult asyncResult)
static IPHostEntry GetHostEntry(string hostNameOrAddress, AddressFamily family)
static IPHostEntry GetHostEntryCore(IPAddress address, AddressFamily addressFamily, ValueStopwatch stopwatch=default(ValueStopwatch))
static IPHostEntry EndGetHostByName(IAsyncResult asyncResult)
static IPHostEntry GetHostEntry(string hostNameOrAddress)
static Task< IPAddress[]> GetHostAddressesAsync(string hostNameOrAddress, CancellationToken cancellationToken)
static IPAddress[] GetHostAddressesCore(IPAddress address, AddressFamily addressFamily, ValueStopwatch stopwatch)
static Task< TResult > RunAsync< TResult >(Func< object, ValueStopwatch, TResult > func, object key, CancellationToken cancellationToken)
static IPHostEntry CreateHostEntryForAddress(IPAddress address)
static IPHostEntry EndGetHostEntry(IAsyncResult asyncResult)
static Task< IPHostEntry > GetHostEntryAsync(IPAddress address)
static string GetHostName()
static Task< T > GetAddrInfoWithTelemetryAsync< T >(string hostName, bool justAddresses, AddressFamily addressFamily, CancellationToken cancellationToken)
static IAsyncResult BeginResolve(string hostName, AsyncCallback? requestCallback, object? stateObject)
static IPHostEntry GetHostByAddress(IPAddress address)
static Task< IPAddress[]> GetHostAddressesAsync(string hostNameOrAddress, AddressFamily family, CancellationToken cancellationToken=default(CancellationToken))
static IAsyncResult BeginGetHostEntry(string hostNameOrAddress, AsyncCallback? requestCallback, object? stateObject)
static IAsyncResult BeginGetHostAddresses(string hostNameOrAddress, AsyncCallback? requestCallback, object? state)
static object GetHostEntryOrAddressesCore(IPAddress address, bool justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch)
static Task< IPHostEntry > GetHostEntryAsync(string hostNameOrAddress, AddressFamily family, CancellationToken cancellationToken=default(CancellationToken))
static IPAddress[] GetHostAddresses(string hostNameOrAddress, AddressFamily family)
static IAsyncResult BeginGetHostByName(string hostName, AsyncCallback? requestCallback, object? stateObject)
static IPHostEntry GetHostByAddress(string address)
static bool LogFailure(ValueStopwatch stopwatch)
static Task< IPHostEntry > GetHostEntryCoreAsync(string hostName, bool justReturnParsedIp, bool throwOnIIPAny, AddressFamily family, CancellationToken cancellationToken)
static IPHostEntry Resolve(string hostName)
static Task< IPHostEntry > GetHostEntryAsync(string hostNameOrAddress, CancellationToken cancellationToken)
static IPAddress[] EndGetHostAddresses(IAsyncResult asyncResult)
static IPHostEntry GetHostEntry(IPAddress address)
static IPHostEntry GetHostEntryCore(string hostName, AddressFamily addressFamily, ValueStopwatch stopwatch=default(ValueStopwatch))
static IPAddress[] GetHostAddresses(string hostNameOrAddress)
static IPAddress[] GetHostAddressesCore(string hostName, AddressFamily addressFamily, ValueStopwatch stopwatch=default(ValueStopwatch))
static Task GetHostEntryOrAddressesCoreAsync(string hostName, bool justReturnParsedIp, bool throwOnIIPAny, bool justAddresses, AddressFamily family, CancellationToken cancellationToken)
static readonly Dictionary< object, Task > s_tasks
static IPAddress Parse(string ipString)
override string ToString()
override bool Equals([NotNullWhen(true)] object? comparand)
static bool TryParse([NotNullWhen(true)] string? ipString, [NotNullWhen(true)] out IPAddress? address)
static readonly IPAddress Any
static readonly IPAddress IPv6Any
static SocketException CreateSocketException(SocketError errorCode, int platformError)
static bool SupportsGetAddrInfoAsync
static unsafe string GetHostName()
static unsafe SocketError TryGetAddrInfo(string name, bool justAddresses, AddressFamily addressFamily, out string hostName, out string[] aliases, out IPAddress[] addresses, out int nativeErrorCode)
static unsafe string TryGetNameInfo(IPAddress addr, out SocketError errorCode, out int nativeErrorCode)
static unsafe Task GetAddrInfoAsync(string hostName, bool justAddresses, AddressFamily family, CancellationToken cancellationToken)
static readonly NameResolutionTelemetry Log
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static bool OSSupportsIPv6
static string net_invalid_ip_addr
static string net_toolong
static string Format(string resourceFormat, object p1)
static TaskScheduler Default
static IAsyncResult Begin(Task task, AsyncCallback callback, object state)
static void End(IAsyncResult asyncResult)
static Task FromCanceled(CancellationToken cancellationToken)
static Task CompletedTask
static Microsoft.Extensions.Internal.ValueStopwatch StartNew()
static CancellationToken None