Packet Sniffer SDK DLL Edition

HNLBAdapter :: Properties :: LbAdpSetThreadCount

 Previous Next

Sets the number of threads created for work with the loopback adapter.

Syntax:

DWORD __stdcall LbAdpSetThreadCount(HANDLE hLbAdp, DWORD ThreadCount);

Parameters:

hLbAdp

[in] HNLBAdapter object handle.

ThreadCount

[in] The number of threads created for work with the loopback adapter (from 1 to LbAdpGetMaxThreadCount).

Return values:

HNERR_OKNo errors.
HNERR_ADAPTER_ALREADY_OPENEDThreadCount must be set before the loopback adapter opening.
HNERR_ADAPTER_THREAD_COUNTThe number of threads may be only from 1 to LbAdpGetMaxThreadCount.
HNERR_INVALID_HANDLEhLbAdp parameter is not the HNLBAdapter object handle.

Description:

Use LbAdpSetThreadCount before opening the loopback adapter (see LbAdpOpenAdapter).

After the loopback adapter has been opened, all the operations with Packet Sniffer SDK internal driver (which provides the direct access to the loopback adapter) are anyway processed by the internal thread(s).

To make the work of Packet Sniffer SDK more effective, very flexible mechanism of the HNLBAdapter object fine-tuning was created: you may set the number of the threads for working with the loopback adapter. ThreadCount property, depending on the task you are solving, allows to set the optimal number of such threads.

To make the traffic capturing better, you should take in account the most important hardware configuration characteristics of your system: CPU(s) speed, RAM size, HDD performance.

The default value of the ThreadCount property is 1.

1. Please note, that if ThreadCount is greater than 1, then OnPacketReceive event handler also may be called by more than one thread simultaneously.

2. If the ReceiveQueue property has been set before the loopback adapter opening, then while executing the code in such operating systems as NT/2000/XP/2003/Vista the ThreadCount will be greater than 1. This is due to the internal implementation of the HNLBAdapter component in the operating systems mentioned above.
ThreadCount property may be used in the Ethernet emulation mode only (see HNLBAdapter.EthEmulation[Get/Set]).
See also:HNLBAdapter, MaxThreadCount, OnPacketReceive, LbAdpGetThreadCount, LbAdpGetReceiveQueue, LbAdpSetReceiveQueue