The jNetPcap SDK provides native calls to the libpcap library installed on the system. The SDK consists of a libpcap wrapper java module which forwards native pcap calls to its native counter part and a jNetPacket module which provides packet and protocol level API, just as jNetPcap v1 did. However the jNetPacket module is optional and the base jNetPcap module provides all the necessary functionality basic packet capture and transmission using generic OS drivers.

Module: com.slytechs.jnet.pcap

jNetPcap module provides the following general functionality:

  • Query runtime native libpcap and jNetPcap API versions (to ensure compatibility)

  • Query network devices/ports available on the system

  • Open and activate methods for setting up a packet capture

  • Capture raw packets using either Pcap.loop or Pcap.dispatch methods

  • Send packets using Pcap.send

  • Use the jNetPacket API to work with dissected packets, reassembled IP datagrams and TCP/QUIC streams, etc...

Module: com.slytechs.jnet.packet

jNetPacket module is a higher layer module that adds a packet and protocol level API. Instead of working with raw data in a buffer or array, this module encapsulates much more information about the captured packets:

  • Frame level information

    • preamble

    • L2 code errors

    • timestamp

    • CRC checks

  • Packet level dissection

    • A Packet class is provided for working with packets and headers

      • Limited scope and by reference to data - a no copy packet object

      • Global scope where data is copied from the capture buffers

    • A Header class is provided for working with individual header or header options

      • Each known protocol header is identified and offset is calculated, accessed using Packet.tryHeader method

    • Reassembly for IP fragments or data streams can be enabled

    • Decryption of TLS or IPSec traffic

    • ProtocolStacks, PacketTemplates and PacketBuilders can be created for transmission and receipt of new packets

    • and a lot more!


Download the main jNetPcap module


  • Native libpcap, winpcap, npcap libraries and packages

  • com.slytechs.jnet.packet java module

  • com.slytechs.jnet.buffer module

  • Java 18 or higher (for foreign function incubator module, project Panama)