Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Java 中打开第 2 层原始套接字?在 C 语言中,我们通常使用 AF_PACKET 级别来打开具有 sockaddr_ll 结构的第 2 层原始套接字。二层编程对应的socket包是什么?
这是不可能使用纯 Java 方法的,因为 Java 在第 3 层以下不提供网络支持。唯一的方法是pcap通过 JNI 使用本机库的解决方法。有几个 Java 库为此提供了更高级别的接口:
pcap
编辑:更新了断开的链接