Examples of IcmpEchoReply


Examples of net.azib.ipscan.core.net.WinIpHlpDll.IcmpEchoReply

    IpAddrByVal ipaddr = new IpAddrByVal();
    ipaddr.bytes = subject.getAddress().getAddress();

    int sendDataSize = 56;
    int replyDataSize = sendDataSize + (new IcmpEchoReply().size()) + 10;
    Pointer sendData = new Memory(sendDataSize);
    sendData.clear(sendDataSize);
    Pointer replyData = new Memory(replyDataSize);

    PingResult result = new PingResult(subject.getAddress());
    try {
      for (int i = 1; i <= count && !currentThread().isInterrupted(); i++) {
        int numReplies = dll.IcmpSendEcho(handle, ipaddr, sendData, (short) sendDataSize, null, replyData, replyDataSize, timeout);
        IcmpEchoReply echoReply = new IcmpEchoReply(replyData);
        if (numReplies > 0 && echoReply.status == 0 && Arrays.equals(echoReply.address.bytes, ipaddr.bytes)) {
          result.addReply(echoReply.roundTripTime);
          result.setTTL(echoReply.options.ttl & 0xFF);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.