简体   繁体   中英

How to read contents of TCP packets from Internet by java

I am researching how to build an Intrusion Prevention System (IPS) application using Java, however I don't know how to redirect Internet packets from a PC to my application and read the packets. The data format I'm looking to get from the packets is similar to the data that Wireshark produces. How would I go about getting low-level packet data like this in a Java application?

Unfortunately, Java does not have access to "raw sockets"--the kind of access you need to get the details you'd expect from a Wireshark dump or the similar.

If you need to use Java for the rest of your application, consider using JNI (link is to a good JNI tutorial). It allows you to use C/C++/Fortran code within a Java application, so you can make system calls and get the kind of access you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM