52 for (
int i = 0; i < 32; i++)
65 if (GetType() == typeof(
Ping))
163 protected override void Dispose(
bool disposing)
173 this.PingCompleted?.Invoke(
this, e);
208 if (
string.IsNullOrEmpty(hostNameOrAddress))
239 public void SendAsync(
string hostNameOrAddress,
object? userToken)
285 SendOrPostCallback d = delegate(
object o)
336 return await
task.ConfigureAwait(continueOnCapturedContext:
false);
350 if (
string.IsNullOrEmpty(hostNameOrAddress))
489 if (!isAsync || (
long)num != 997)
493 return Task.FromResult(
new PingReply(address,
null, statusFromCode, 0
L,
Array.Empty<
byte>()));
496 if (taskCompletionSource !=
null)
498 return taskCompletionSource.
Task;
517 },
this, -1, executeOnlyOnce:
true);
565 global::Interop.IpHlpApi.IPOptions options2 =
new global::Interop.IpHlpApi.IPOptions(
options);
568 return (
int)global::Interop.IpHlpApi.IcmpSendEcho2(
_handlePingV4,
GetWaitHandle(isAsync),
IntPtr.
Zero,
IntPtr.
Zero, (uint)address.
Address,
_requestBuffer, (ushort)
buffer.Length, ref options2,
_replyBuffer, 65791u, (uint)
timeout);
572 byte[] sourceSocketAddress =
new byte[28];
573 return (
int)global::Interop.IpHlpApi.Icmp6SendEcho2(
_handlePingV6,
GetWaitHandle(isAsync),
IntPtr.
Zero,
IntPtr.
Zero, sourceSocketAddress, socketAddress.
Buffer,
_requestBuffer, (ushort)
buffer.Length, ref options2,
_replyBuffer, 65791u, (uint)
timeout);
624 else if (pingReply !=
null)
626 taskCompletionSource.
SetResult(pingReply);
638 for (
int i = 0; i <
buffer.Length; i++)
655 if (statusCode != 0 && statusCode < 11000)
669 if (statusFromCode ==
IPStatus.Success)
671 rtt = reply.roundTripTime;
673 array =
new byte[reply.dataSize];
691 if (statusFromCode ==
IPStatus.Success)
693 rtt = reply.RoundTripTime;
694 array =
new byte[sendSize];
static Microsoft.Win32.SafeHandles.SafeLocalAllocHandle LocalAlloc(int cb)
static AsyncOperation CreateOperation(object? userSuppliedState)
object? UserSuppliedState
void PostOperationCompleted(SendOrPostCallback d, object? arg)
static void SuppressFinalize(object obj)
static Task< IPAddress[]> GetHostAddressesAsync(string hostNameOrAddress)
static IPAddress[] GetHostAddresses(string hostNameOrAddress)
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
AddressFamily AddressFamily
static bool OSSupportsIPv4
static bool OSSupportsIPv6
static System.Net.Internals.SocketAddress Serialize(EndPoint endpoint)
static int GetLastPInvokeError()
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
static ? object PtrToStructure(IntPtr ptr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type structureType)
IntPtr DangerousGetHandle()
static string net_invalid_ip_addr
static string net_inasync
static string net_ipv4_not_installed
static string net_ipv6_not_installed
static string net_invalidPingBufferSize
bool Unregister(WaitHandle waitObject)
void SetException(Exception exception)
static TaskScheduler Default
Task ContinueWith(Action< Task< TResult > > continuationAction)
bool IsCompletedSuccessfully
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
AggregateException? Exception
static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callBack, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce, bool flowExecutionContext)
virtual void Dispose(bool explicitDisposing)
static readonly IntPtr Zero
static CancellationToken None