Skip to content
Taiizor edited this page Mar 1, 2023 · 11 revisions
<title>PingExtension Class</title>

PingExtension Class

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

<h2>Namespace:</h2>
<p><code>Skylark.Standard.Extension.Ping</code></p>

<h2>Assembly:</h2>
<p><code>Skylark.Standard.dll</code></p>

<h2>Syntax:</h2>
<pre><code>public static class PingExtension</code></pre>

<h2>Methods:</h2>

<h3>Send Method</h3>
<p>Sends a ping request to the specified address and returns a <code>PingSendStruct</code> object containing the results.</p>

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

<h4>Returns:</h4>
<p>A <code>PingSendStruct</code> object containing the results of the ping request.</p>

<h4>Exceptions:</h4>
<p>If an error occurs, an <code>Exception</code> is thrown.</p>

<h4>Example:</h4>
<pre><code>using Skylark.Standard.Extension.Ping;

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

<h3>SendAsync Method</h3>
<p>Sends a ping request to the specified address asynchronously and returns a <code>Task</code> object containing a <code>PingSendStruct</code> object with the results.</p>

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

<h4>Returns:</h4>
<p>A <code>Task&lt;PingSendStruct&gt;</code> object containing the results of the ping request.</p>

<h4>Exceptions:</h4>
<p>If an error occurs, an <code>Exception</code> is thrown.</p>

<h4>Example:</h4>
<pre><code>using Skylark.Standard.Extension.Ping;

Task<SPP

Clone this wiki locally