jNetPcap vs Jpcap
wondering any of you can give me a bit of comments + insights please. In term of performanc开发者_C百科e, which one should I use, jNetPcap or Jpcap?
Thanks!
The referenced post contains an admittedly biased opinion by the owner of the jNetPcap project. It is hardly a reliable source for a true comparison.
One difference that is obvious between the two projects is that jNetPcap uses JNI for access to native code. PCap4j (http://www.pcap4j.org/) uses JNA for access to native code and a "com.sun" JNA compatibility library (https://github.com/twall/jna).
Also, the latest version of jNetPcap does not build on Mac OSX and the patch file that was posted to the support forums does not work, even if manually applied. PCap4j run on Mac OSX if the instructions at http://tomute.hateblo.jp/entry/2013/01/27/003209 are followed; for PCap4J 1.3.0 you must replace the JNA 3.3.0 library with the newer versions JNA 4.1.0.
The following command line is an example for PCap4j 1.3.0 on Mac OSX 10.9.5: sudo java -cp pcap4j-core-1.3.0.jar:pcap4j-packetfactory-static-1.3.0.jar:./libs/jna-4.1.0.jar:./libs/slf4j-api-1.7.10.jar:./libs/slf4j-nop-1.7.10.jar:pcap4j-sample-1.3.0.jar -Dorg.pcap4j.core.pcapLibName=libpcap.dylib -Dorg.pcap4j.sample.Loop.count=2 org.pcap4j.sample.Loop icmp
I was looking for the same thing.. Just for the ones who come across with this question. Here is the link.
I researched it and found three Java wrapper libraries for pcap: jpcap, jNetPcap, and Jpcap. But both jpcap and jNetPcap were unsuitable for SNeO because they seemed to be designed for mainly capturing packets and not to be useful for making and sending packets so much. On the other hand, Jpcap looked useful for making and sending packets. But it had a defect in capturing ICMP packets and its development seemed to be stopped long ago. That's why Pcap4j.
https://github.com/kaitoy/pcap4j#system-requirements
精彩评论