Obtain a packet capture handle (Pcap) with a specific network interface (adapter) to look at packets on the network and process it with Pcap.loop(int, PacketHandler, T args).
Once the adapter is opened, the capture can be started with Pcap.dispatch(int, PacketHandler, T args) or Pcap.dispatch(int, PacketHandler, T args). These two functions are very similar, the difference is that Pcap.dispatch(int, PacketHandler, T args) returns (although not guaranteed) when the timeout expires while Pcap.loop(int, PacketHandler, T args) doesn't return until maximum packets have been captured, so it can block for an arbitrary period on an under-utilized network.