Packet Sniffer SDK DLL Edition

Events :: OnPacketReturn

 Previous Next

Fired immediately after releasing a packet for further using.

Syntax:

void __stdcall OnPacketReturn(DWORD_PTR Param, HANDLE hPacket, DWORD Reason);

Parameters:

Param

[in] OnPacketReturn event handler parameter. May be set by the TcpMgrSetOnReturn function call.

hPacket

[in] HNPacket object handle.

Reason

[in] Values of this parameter are defined in the HNTcpReturnReason enumeration.

Description:

Set this event handler to make necessary actions at the moment of releasing a packet for further using.

Incoming packets are transmitted to the HNTcpManager for further processing as HNPacket objects by TcpMgrProcessPacket function.

HNTcpManager extracts from HNPacket objects TCP data, and then notifies you about unnecessary HNPacket objects sending their handles to the OnPacketReturn event handler.

After you've got such used (released) HNPacket objects, you should use them repeatedly, or release the resources allocated for them (only if you allocated resources for them), or return them to the queue as soon as possible (if such object before sending to the TcpMgrProcessPacket function was received from the queue).

This event handler is called in the context of a thread, which has called TcpMgrProcessPacket function.

This event handler is mandatory for HNTcpManager.

You also have to keep in mind that TCP protocol allows data transmission desequencing (RFC 793), that is why during the process of asssembling TCP session HNTcpManager component may cause a delay in the processing of a certain TCP packet. Consequently it is possible that a packet, that has been transmited in TcpMgrProcessPacket function for processing, may become accessible for further use in OnPacketReturn only after a while.
See also:HNTcpManager, TcpMgrSetOnReturn, HNPacket, TcpMgrProcessPacket, HNTcpReturnReason