Is it possible to implement a port/network sniffer in Java? This tool should be able to monitor ports used by other processes on the same machine.

Tim Rohaly

No, this is not possible using just Java. A sniffer program requires the use of promiscuous sockets. Promiscuous sockets usually require root or equivalent permission to create, and are not supported on some OSes. Java does not support promiscuous sockets, so you can't write a sniffer in Java.

If your OS supports promiscuous sockets, you can write native code using the JNI for this purpose.