PingService class

网络延迟(Ping)测试服务 / Network latency (ping) test service.

默认使用 TCP 握手往返测量,跨平台且无需特殊权限;桌面端可选择使用系统 ICMP ping 命令 / TCP handshake timing is used by default: it works on every platform without extra privileges. Desktop platforms may opt into the system ICMP ping command instead.

Constructors

PingService({int defaultPort = 443})
构造 PingService / Creates a PingService.
const

Properties

defaultPort int
TCP 模式下默认探测端口 / Default probe port in TCP mode.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ping({required String host, int count = 4, Duration timeout = const Duration(seconds: 3), Duration interval = const Duration(milliseconds: 200), int? port, PingMode mode = PingMode.tcp}) Future<PingResult>
执行 Ping 测试 / Runs a ping test.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited