Packet Sniffer SDK VCL Edition

HNAdapter :: Properties :: SendQueue

 Previous Next

Sets/Returns the handle of the HNQueue object for packets sending.

Syntax:

property SendQueue: Pointer;

Description:

Use SendQueue to set queue for packets sending.

You can arrange traffic sending using packets queue with help of the HNQueue component. To do this you should set SendQueue to not-NULL before network adapter opening: in this case while adapter opening the HNAdapter object will create additional auxiliary thread which will be awaiting for packets with Full status (see HNQueue). Immediately after such packet appears in the queue, it will be sent to the network and returned to the queue with status Free.

SendQueue property can be changed only when HNAdapter component is closed (see IsOpened).

To set packets queue for the network adapter, please do the following:

...
HNQueue.MaxPacketSize := 1514;
HNQueue.ItemsCount := 50000;
HNQueue.AllocItems();
HNAdapter.SendQueue := HNQueue.Handle;
...
HNAdapter.OpenAdapter();
...
for i := 0 to 50000 do
begin
    HNPacket.Handle := HNQueue.Get_FreeItem(INFINITE);
    if hPkt = nil then exit;
	
    pPktData := HNPacket.PacketData;
    ...
    memcpy(pPktData, DataBuff, 1514);
    HNPacket.IncPacketSize := 1514;
	
    HNQueue.Return_FullItem(hPkt);
end;
...
HNAdapter.CloseAdapter();
...
HNQueue.FreeItems();
See also:HNAdapter, HNQueue