tcping icon indicating copy to clipboard operation
tcping copied to clipboard

ping time不应该包含dns解析时间吧?

Open shadu120 opened this issue 2 years ago • 0 comments

ubuntu@ubuntu-pc:~$ ./tcping example.com 22
Ping tcp://example.com:22(145.28.112.37:22) - Connected - time=250.081038ms
Ping tcp://example.com:22(145.28.112.37:22) - Connected - time=259.093898ms
Ping tcp://example.com:22(145.28.112.37:22) - Connected - time=253.900446ms
Ping tcp://example.com:22(145.28.112.37:22) - Connected - time=253.49524ms

Ping statistics tcp://example.com:22
        4 probes sent.
        4 successful, 0 failed.
Approximate trip times:
        Minimum = 250.081038ms, Maximum = 259.093898ms, Average = 254.142655ms
ubuntu@ubuntu-pc:~$ ./tcping 145.28.112.37 22
Ping tcp://145.28.112.37:22(145.28.112.37:22) - Connected - time=75.645099ms
Ping tcp://145.28.112.37:22(145.28.112.37:22) - Connected - time=71.512504ms
Ping tcp://145.28.112.37:22(145.28.112.37:22) - Connected - time=61.02463ms
Ping tcp://145.28.112.37:22(145.28.112.37:22) - Connected - time=59.13156ms

Ping statistics tcp://145.28.112.37:22
        4 probes sent.
        4 successful, 0 failed.
Approximate trip times:
        Minimum = 59.13156ms, Maximum = 75.645099ms, Average = 66.828448ms

时间计算应该是在DNS解析成功后,connect开始计算。 不能把DNS解析时间算上。

shadu120 avatar Jan 25 '23 10:01 shadu120