lazebird.rabbit.ping
2.0.0
See the version list below for details.
dotnet add package lazebird.rabbit.ping --version 2.0.0
NuGet\Install-Package lazebird.rabbit.ping -Version 2.0.0
<PackageReference Include="lazebird.rabbit.ping" Version="2.0.0" />
paket add lazebird.rabbit.ping --version 2.0.0
#r "nuget: lazebird.rabbit.ping, 2.0.0"
// Install lazebird.rabbit.ping as a Cake Addin
#addin nuget:?package=lazebird.rabbit.ping&version=2.0.0
// Install lazebird.rabbit.ping as a Cake Tool
#tool nuget:?package=lazebird.rabbit.ping&version=2.0.0
ping
Description
Target
API
public rping(Action<string> log) 构造函数 log:log输出接口
public void start(string addr, int timeout, Action<int, PingReply> callback) 同步执行ping操作 addr:ping地址 timeout: ping超时时间,单位毫秒 callback:处理结果的回调函数,第一个参数为请求id,用于匹配请求和响应;第二个参数为ping结果对象
public int start_async(string addr, int timeout, Action<int, PingReply> callback) 异步执行ping操作 addr:ping地址 timeout: ping超时时间,单位毫秒 callback:处理结果的回调函数,第一个参数为请求id,用于匹配请求和响应;第二个参数为ping结果对象
Sample
rping ping = new rping(ping_log_func);
void ping_log_func(string msg)
{
console.write(msg);
}
void ping_cb(int id, PingReply reply)
{
if (reply == null) // exception
{
}
else if (reply.Status == IPStatus.Success)
{
pinglog.write("来自 " + reply.Address + " 的回复: 字节=" + reply.Buffer.Length + " 毫秒=" + reply.RoundtripTime + " TTL=" + reply.Options.Ttl);
}
else
{
pinglog.write("请求超时。");
}
}
ping.start(addr, timeout, ping_cb);
void scan_reply(int id, PingReply reply)
{
if (reply == null || reply.Status != IPStatus.Success)
{
((Label)lbhash[id]).BackColor = Color.Red;
}
}
int id = ping.start_async(addr, timeout, scan_reply);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
support sync and async ping request, reply callback