java - Appreciation about Pcap devices -


i'm trying automatically active device on system.

for example:

my pc has 2 devices. 1. tap-windows adapter v9 2. intel(r) ethernet connection

actually active device intel connection.

so want application can automatically use active device dump pcap.

my idea search subnetmask in both devices. active device has inet4 ip mask=[inet4: 255.255.255.0]. deactive 1 gives me this: mask=[0]

is right thinking, active device never gets mask of 0?

this extends broadcast.

here implementation:

static public pcapif selectactivedev(list alldevs){ pcapif device = new pcapif();

for(int = 0; a<=alldevs.size()-1; a++){     if(alldevs.get(a).getaddresses().get(0).getnetmask().tostring() != "0"){         device = alldevs.get(a);             } } return device;   

}

i'm using jnetpcap 1.3.0 eclipse. :)


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -