Is there a way to send ARP request via Java?

笑着哭i 提交于 2019-11-28 03:42:43

问题


Is there a way to send ARP request within a Java application? I know that ARP is sitting a layer under TCP and UDP therefore by default Java couldn't send ARP request. I am just wondering is there any 3rd party Java library that will allow you to send ARP request.

To capture ARP reply, I know I can use jpcap so that part is solved.

Thanks


回答1:


A java app can always execute some external command, calling another tool to do it. I'm not sure what you mean by "standard java" though.

Based on googling, there seems to be arping in kraken pcap which is in Java. See about Kraken.

There's also jpcap as well that's used for the purpose.




回答2:


As you've stated, the Java standard library does not provide a low level enough networking API to send an ARP request.

The pcap4j provides Java bindings for libpcap / winpcap and thus can be used to send an ARP request. Information on the library can be found on their homepage. See this sample for how to send an ARP request.




回答3:


No, not in native Java (I'm guessing this is due to security concerns). It can be done although it does require the use of C++/C native code libraries and JNI programming. https://forums.oracle.com/forums/thread.jspa?threadID=1690617



来源:https://stackoverflow.com/questions/14650089/is-there-a-way-to-send-arp-request-via-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!