Domanda

I'm looking to implement a reverse QoS system (because I don't have the resources to saturate my network to actually do QoS). Everything I have seen about capturing network traffic using Java seems to point to Jpcap - a 3+ year old library, or to other similar projects. Additionally, reading through the java.net documentation didn't help much, though the ServerSocket class seems to be on the right track.

What I'm looking for is the actual library source code, or a newer/supported framework for this. I want to grab all packets coming over the network and throw them into buffers, and then release them from the buffers after a designated amount of time, depending on the protocol the packet is carrying.

I know how to create socket applications, but have no idea how to go a level up (down technically) to interfaces. Help would be greatly appreciated!

È stato utile?

Soluzione

What you're looking for is simply outside of the scope for a universal java application.

If you're planning on keeping a specific OS in mind, such as Windows or Linux (my following examples), then there are a few things you can do.

For Windows, any given application will be unable to do this without driver privileges. WinPCap is probably the most widely used tool in this case, and that's what jpcap utilizes. It's a "driver" that basically just Man-in-the-middle's your traffic.

For Linux, take a look at this other post https://security.stackexchange.com/questions/13267/monitoring-outgoing-network-traffic

I know this is a sideways answer since it gives no Java code, but that's because Java simply isn't built to interface with the system in that way.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top