Package jpcap

Examples of jpcap.JpcapSender.sendPacket()


    icmp.datalink=ether;
   
    captor.setFilter("icmp and dst host "+thisIP.getHostAddress(),true);
    JpcapSender sender=captor.getJpcapSenderInstance();
    //JpcapSender sender=JpcapSender.openDevice(device);
    sender.sendPacket(icmp);
    while(true){
      ICMPPacket p=(ICMPPacket) captor.getPacket();
      //System.out.println("received "+p);
      if(p==null){
        System.out.println("Timeout");
View Full Code Here


      }else if(p.type==ICMPPacket.ICMP_ECHOREPLY){
        p.src_ip.getHostName();
        System.out.println(icmp.hop_limit+": "+p.src_ip);
        System.exit(0);
      }else continue;
      sender.sendPacket(icmp);
    }
  }
}
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.