问题描述
想知道你们中的任何人可以给我一些评论+见解。
在性能方面,我应该使用哪一个,jNetPcap或Jpcap?
wondering any of you can give me a bit of comments + insights please.In term of performance, which one should I use, jNetPcap or Jpcap?
谢谢!
推荐答案
所引用的帖子包含了jNetPcap项目所有者的公认偏见。它不是真正比较的可靠来源。
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.
两个项目之间明显的一个区别是jNetPcap使用JNI来访问本机代码。 PCap4j()使用JNA访问本机代码和com.sunJNA兼容性库()。
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).
此外,最新版本的jNetPcap不是基于Mac OSX构建的,即使手动应用,发布到支持论坛的补丁文件也不起作用。如果被跟踪;对于PCap4J 1.3.0,您必须使用较新版本的JNA 4.1.0替换JNA 3.3.0库。
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.
以下命令行是PCap4j 1.3.0的示例在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
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
这篇关于jNetPcap vs Jpcap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!