This enables us to increase the time of a packet processing in your application, for each packet
separately. Thus, one can have real-time numerous packets processing without packet loss if the queue
parameters for a particular task are calculated.
To use OnPacketsReceive event handler, you should set
ReceiveManyAtOnce flag to TRUE before
QueStart function call.
You should remember that OnPacketsReceive event handler processing occurs
after QueGetFullItems function call, that is why when you finish
working with the queue elements, they should be returned to the end of the queue by
QueReturnFreeItem(QueReturnFreeItems)
function call.
//---------------------------------------------------------------------------
// Event handler OnPacketsReceive of the HNQueue object
//---------------------------------------------------------------------------
procedure OnPacketsReceive(Param: Pointer; ThParam: Pointer; hPackets: Pointer; dwCount: Cardinal); stdcall;
var
pEth: PETHERNET_HEADER;
begin
for ... do
begin
case (PktGetMediumType(hPackets^.[...])) of
atEthernet:
pEth := PETHERNET_HEADER(PktGetPacketData(hPackets^.[...]));
...
break;
else:
Exit;
end;
...
end;
QueReturnFreeItems(hQue,hPackets,dwCount);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
end;