Packet Sniffer SDK DLL Edition

HNPacket :: Properties :: PktGetIncPacketSize

 Previous Next

Returns the size of the packet's data sent by PSSDK driver to the user application.

Syntax:

DWORD __stdcall PktGetIncPacketSize(HANDLE hPkt);

Parameters:

hPkt

[in] HNPacket object handle.

Return values:

If the function succeeds the return value will be the size of the packet's data sent by PSSDK driver to the user application, otherwise it will be 0.

Description:

Use PktGetIncPacketSize to get the size of the incoming packet data stored in HNPacket object.

This value cannot be greater than MaxPacketSize[Get] value, but may be less than PacketSize[Get/Set] value.

The size of the packet received from the system by PSSDK internal driver and the size of the packet received by application from PSSDK driver may differ.

For example, if you set your own BPF filter, and set in the BPF instruction RET (see BPF instructions) that you need only first N bytes from the packet, then the value of IncPacketSize will be the actual size of the packet passed by PSSDK driver to the application.

This value also may be less than the value set in the RET instruction in the BPF filter if the packet is shorter.

In OnPacketReceive event handlers this property is duplicated by IncPacketSize parameter for easier access.

See also:HNPacket, PktGetMaxPacketSize, PktGetPacketSize, PktSetPacketSize, OnPacketReceive