Is it possible to listen to ANY IP address?

时间:2016-02-12 20:31:48

标签: networking

May I listen to any ip address from a java application?

Please note that I do not mean to say any existing local address.

I'm talking about any ip address.

I have a network interface receiving traffic mirrored from a certain link, and the destination IP address will vary "randomly", but I want to be able to get those packets to be sent to my java application.

Thanks. -Bob

2 个答案:

答案 0 :(得分:1)

With the library jpcap you can sniffing all packages incoming and outgoing from a network interface. http://jpcap.sourceforge.net/

Or perhaps you need Java Sockets. https://docs.oracle.com/javase/tutorial/networking/sockets/

答案 1 :(得分:0)

This is a pretty open ended question, can you be a little more specific?

The answer is yes, you can listen to any IP address that the network stack of your hosting OS can see (even if it's not for the network card in the system but modern switching will limit how useful that is, see promiscuous network).

Try using 0.0.0.0 as the expected address in your configuration but it seems like there is something missing on your question.