Java – How to read and write raw ip packets from java on a mac


What would be the easiest way to be able to send and receive raw network packets. Do I have to write my own JNI wrapping of some c API, and in that case what API am I looking for?

EDIT: I want to be able to do what wireshark does, i.e. record all incomming packets on an interface, and in addition be able to send back my own created packets. And I want to do it on a mac.

Best Solution

If you start with the idea that you need something like a packet sniffer, you'll want to look at