PingService class
Web 端网络延迟(Ping)测试服务 / Latency (ping) test service for the web.
浏览器无法建立任意 TCP / ICMP 连接,因此:
- PingMode.tcp 退化为对目标主机发起 HTTPS 请求并测量往返耗时;
- PingMode.icmp 在 Web 上不可用时抛出 UnsupportedError / Browsers cannot open arbitrary TCP or ICMP connections, so on the web:
- PingMode.tcp degrades to measuring the round trip of an HTTPS request;
- PingMode.icmp is unavailable and throws UnsupportedError.
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