jNetPcap 与 Jpcap
想知道你们中的任何人都可以给我一些评论+见解。 就性能而言,我应该使用 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?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
所引用的帖子包含 jNetPcap 项目所有者承认的有偏见的观点。它几乎不是真正比较的可靠来源。
这两个项目之间的一个明显区别是 jNetPcap 使用 JNI 来访问本机代码。 PCap4j (http://www.pcap4j.org/) 使用 JNA 访问本机代码和“com.sun”JNA 兼容性库(https://github.com/twall/jna)。
此外,最新版本的 jNetPcap 不是在 Mac OSX 上构建的,并且即使手动应用,发布到支持论坛的补丁文件也不起作用。如果按照 http://tomute.hateblo.jp/entry/2013/01 中的说明,则 PCap4j 在 Mac OSX 上运行已关注/27/003209;对于 PCap4J 1.3.0,您必须将 JNA 3.3.0 库替换为较新版本的 JNA 4.1.0。
以下命令行是 Mac OSX 10.9.5 上的 PCap4j 1.3.0 的示例:
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 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.
我研究了一下,发现了 pcap 的三个 Java 包装器库:jpcap、jNetPcap 和 Jpcap。但 jpcap 和 jNetPcap 都不适合 SNeO,因为它们似乎主要是为捕获数据包而设计的,对于制作和发送数据包没有太大用处。另一方面,Jpcap 对于制作和发送数据包看起来很有用。但它在捕获ICMP数据包方面存在缺陷,其开发似乎早已停止。这就是 Pcap4j 的原因。
https://github.com/kaitoy/pcap4j#system-requirements
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