Skip to content
Taiizor edited this page Mar 1, 2023 · 11 revisions

PingExtension Class - Skylark.Standard.Helper Namespace

The PingExtension class provides extension methods for sending ping requests and receiving ping replies.

Methods:

Send Method

Sends a ping request to the specified address and returns a PingSendStruct object containing the results.

Parameters:

  • Address: Optional. The IP address or hostname of the destination. Default is PingManage.Address.
  • Timeout: Optional. The maximum time, in milliseconds, to wait for a reply. Default is PingManage.Timeout.
  • Ttl: Optional. The Time-to-Live value for the ping request. Default is PingManage.Ttl.
  • Fragment: Optional. Specifies whether the ping packet should be fragmented. Default is PingManage.Fragment.

Returns:

A PingSendStruct object containing the results of the ping request.

Exceptions:

If an error occurs, an Exception is thrown.

Example:

using Skylark.Standard.Extension.Ping;
SPPSS result = PingExtension.Send("www.google.com");
Console.WriteLine("Result: {0}", result.Result);

SendAsync Method

Sends a ping request to the specified address asynchronously and returns a Task object containing a PingSendStruct object with the results.

Parameters:

  • Address: Optional. The IP address or hostname of the destination. Default is PingManage.Address.
  • Timeout: Optional. The maximum time, in milliseconds, to wait for a reply. Default is PingManage.Timeout.
  • Ttl: Optional. The Time-to-Live value for the ping request. Default is PingManage.Ttl.
  • Fragment: Optional. Specifies whether the ping packet should be fragmented. Default is PingManage.Fragment.

Returns:

A Task<PingSendStruct> object containing the results of the ping request.

Exceptions:

If an error occurs, an Exception is thrown.

Example:

using Skylark.Standard.Extension.Ping;
Task<SPP> result = await PingExtension.SendAsync("www.google.com");
Console.WriteLine("Result: {0}", result.Result);
Clone this wiki locally