net.sourceforge.jpcap.capture
Class SyncPacketCapture
java.lang.Object
net.sourceforge.jpcap.capture.PacketDispatcher
net.sourceforge.jpcap.capture.PacketCaptureBase
net.sourceforge.jpcap.capture.PacketCapture
net.sourceforge.jpcap.capture.SyncPacketCapture
- All Implemented Interfaces:
- PacketCaptureCapable, PacketDispatchCapable, net.sourceforge.jpcap.capture.PacketHandler
- public class SyncPacketCapture
- extends PacketCapture
This class adds to PacketCapture the ability to explicitly terminate
a capture session using close().
SyncPacketCapture utilizes libpcap's pcap_dispatch().
SyncPacketCapture inherits from the PacketCapture overriding its
open(), capture() and close() methods in a way to keep synchronized the
starting and the stopping phases of any capture() session . That
allows close() method call to be performed any time from everywhere.
Method Summary |
void |
capture(int pck_count)
Capture packets. |
void |
close()
Close the capture device. |
protected void |
syncCapture(int pck_count)
|
Methods inherited from class net.sourceforge.jpcap.capture.PacketCapture |
capture, close, findDevice, getLinkLayerType, getLinkLayerType, getNetmask, getNetwork, getSnapshotLength, getSnapshotLength, getStatistics, lookupDevices, open, open, open, openOffline, openOffline, setFilter, setFilter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SyncPacketCapture
public SyncPacketCapture()
syncCapture
protected void syncCapture(int pck_count)
throws CapturePacketException
- Throws:
CapturePacketException
capture
public void capture(int pck_count)
throws CapturePacketException
- Description copied from interface:
PacketCaptureCapable
- Capture packets.
- Specified by:
capture
in interface PacketCaptureCapable
- Overrides:
capture
in class PacketCapture
- Throws:
CapturePacketException
close
public void close()
- Description copied from interface:
PacketCaptureCapable
- Close the capture device.
- Specified by:
close
in interface PacketCaptureCapable
- Overrides:
close
in class PacketCapture