A Capturing Network Packets (also known as sniffer or packet analyzer) is computer software that can intercept and log traffic passing over a digital network or part of a network.As data streams flow across the network, the sniffer captures each packet and eventually decodes and analyzes its content according to the appropriate RFC(request for comments ) or other specifications.
How it works
Let’s say your computer is in network #1 and it was connected to a hub. All computers in your network receive same signal. It means your computer sockets receive all signals in the network.
But operating system is extract only massagers address to you (your computer).

Depth
How it works
Let’s say your computer is in network #1 and it was connected to a hub. All computers in your network receive same signal. It means your computer sockets receive all signals in the network.
But operating system is extract only massagers address to you (your computer).
Depth
Your computer is connecting to #1 network; they you can see all packets sending and receiving to 192,168.1.1 …5.
Your computer is connecting to #2 network; they you can see all packets sending and receiving to 192,168.1.6 and 7 + packet sending and receiving to #1 and other..
Lets say you send a message from 192.168.1.1 to 192.168.1.5; (a feature of switching hub) that message will route directly to it and not visible to network #2.
How packet behaves
Security makes more cost, traffic and more processing power. So it becomes slower and inefficient.
Next: how to read packet using java
Keep in touch