A
A
Alexey Andrianov2010-10-07 08:57:49
linux
Alexey Andrianov, 2010-10-07 08:57:49

How to make Ping indicating the time of sending/receiving a packet?

You need to get a line like: plus, it is desirable to write it to the log. You need 2 solutions, for Windows and Linux. What not to offer below is a mockery: \ UPD: There is a solution for Windows and Linux.
Обмен пакетами с 192.168.213.1 по с 32 байтами данных:
[09:54:01] Ответ от 192.168.213.1: число байт=32 время<1мс TTL=64
[09:54:02] Ответ от 192.168.213.1: число байт=32 время<1мс TTL=64
...


time /t >> 1.txt & ping -n 1 xxx.yyy.zzz.www >> 1.txt

Answer the question

In order to leave comments, you need to log in

4 answer(s)
T
tyomitch, 2010-10-07
@andan

Windows version:

for /l %i in (0,0,1) do @cmd /c "echo.|set/p=%TIME:~0.8^%" & ping -n 1 google.com | find "Reply" & ping -n 2 localhost > nul

S
Sergey, 2010-10-07
@bondbig

#!/bin/bash
while true
    do
        TIME=`date +%T`
        PING=`ping $1 -c 2 | grep icmp | grep seq=2`
            echo "[$TIME] $PING" >>/tmp/pingtime.log
            echo "[$TIME] $PING" 
  sleep 5
    done


image

G
gendalfbbk, 2022-02-14
@gendalfbbk

ping -t 8.8.8.8|cmd /q /v /c "(pause&pause)>nul & for /l %a in () do (set /p "data=" && echo(!date! !time! !data! )&ping -n 2 8.8.8.8>nul"

A
Alexey Andrianov, 2010-10-07
@andan

2bondbig says so

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question