Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DoSendPingCore()

Task< PingReply > System.Net.NetworkInformation.Ping.DoSendPingCore ( IPAddress address,
byte[] buffer,
int timeout,
PingOptions options,
bool isAsync )
inlineprivate

Definition at line 457 of file Ping.cs.

458 {
459 TaskCompletionSource<PingReply> taskCompletionSource = null;
460 if (isAsync)
461 {
462 taskCompletionSource = (_taskCompletionSource = new TaskCompletionSource<PingReply>());
463 }
464 _ipv6 = address.AddressFamily == AddressFamily.InterNetworkV6;
465 _sendSize = buffer.Length;
467 if (_replyBuffer == null)
468 {
470 }
471 int num;
472 try
473 {
474 if (isAsync)
475 {
477 }
479 num = SendEcho(address, buffer, timeout, options, isAsync);
480 }
481 catch
482 {
483 Cleanup(isAsync);
484 throw;
485 }
486 if (num == 0)
487 {
489 if (!isAsync || (long)num != 997)
490 {
491 Cleanup(isAsync);
492 IPStatus statusFromCode = GetStatusFromCode(num);
493 return Task.FromResult(new PingReply(address, null, statusFromCode, 0L, Array.Empty<byte>()));
494 }
495 }
496 if (taskCompletionSource != null)
497 {
498 return taskCompletionSource.Task;
499 }
500 Cleanup(isAsync);
501 return Task.FromResult(CreatePingReply());
502 }
static Microsoft.Win32.SafeHandles.SafeLocalAllocHandle LocalAlloc(int cb)
TaskCompletionSource< PingReply > _taskCompletionSource
Definition Ping.cs:43
unsafe void SetUnmanagedStructures(byte[] buffer)
Definition Ping.cs:634
SafeLocalAllocHandle _replyBuffer
Definition Ping.cs:37
void Cleanup(bool isAsync)
Definition Ping.cs:588
int SendEcho(IPAddress address, byte[] buffer, int timeout, PingOptions options, bool isAsync)
Definition Ping.cs:563
static IPStatus GetStatusFromCode(int statusCode)
Definition Ping.cs:653

References System.Net.NetworkInformation.Ping._ipv6, System.Net.NetworkInformation.Ping._replyBuffer, System.Net.NetworkInformation.Ping._sendSize, System.Net.NetworkInformation.Ping._taskCompletionSource, System.buffer, System.Net.NetworkInformation.Ping.Cleanup(), System.Net.NetworkInformation.Ping.CreatePingReply(), System.Runtime.InteropServices.Marshal.GetLastPInvokeError(), System.Net.NetworkInformation.Ping.GetStatusFromCode(), System.Net.NetworkInformation.Ping.InitialiseIcmpHandle(), System.L, Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.LocalAlloc(), System.options, System.Net.NetworkInformation.Ping.RegisterWaitHandle(), System.Net.NetworkInformation.Ping.SendEcho(), System.Net.NetworkInformation.Ping.SetUnmanagedStructures(), System.Threading.Tasks.TaskCompletionSource< TResult >.Task, and System.timeout.

Referenced by System.Net.NetworkInformation.Ping.SendPingAsyncCore(), and System.Net.NetworkInformation.Ping.SendPingCore().