java - How to get the time interval a ping request is sent and received -
i need run tests emulator using, , need test specified rtt delay. rtt delay 10x more, , @ times, need test if in reality correct. instance if emulator's log says @ time x rtt set 400ms, can see verify using real application connected emulator's network. best way using ping timestamps. there ways specify when ping request has been sent, , delay is? or feel free suggest other methods test case.
i have java implementation send ping requests!
public static void main(string[] args) throws unknownhostexception, ioexception { string ipaddress = "127.0.0.1"; inetaddress inet = inetaddress.getbyname(ipaddress); system.out.println("sending ping request " + ipaddress); system.out.println(inet.isreachable(5000)); }
string ipaddress = "127.0.0.1"; inetaddress inet = inetaddress.getbyname(ipaddress); system.out.println("sending ping request " + ipaddress); int uptime = (int) system.currenttimemillis(); system.out.println((inet.isreachable(5000) ? ((int) system.currenttimemillis() - uptime)+"ms" : "request timed out"));
Comments
Post a Comment