public class ARP { public static byte[] arp(InetAddress ip) throws java.io.IOException{ //發現本機器的網絡接口 int i; NetworkInterface[] devices=JpcapCaptor.getDeviceList(); NetworkInterface device=null; for (i = 0; i < devices.length; i++) { System.out.PRintln(devices[i].description); } device = devices[2];//我的機器是第三個進行網絡通信
if(device==null) throw new IllegalArgumentException(ip+" is not a local address");