Packet Sniffer SDK VCL Edition

HNAdapter :: Methods :: OpenAdapter

 Previous Next

Opens the network adapter.

Syntax:

function OpenAdapter: DWORD;

Return values:

HNERR_OKNetwork adapter opening has been completed successfully.
HNERR_CONFIG_NOT_DEFINEDNetwork adapter configuration is not defined for the HNAdapter object. See ConfigHandle property of the HNAdapter component.
HNERR_ADAPTER_NOT_OPENEDNetwork adapter opening error.
HNERR_MEM_ALLOC_ERRORThe memory for the traffic processing is not allocated. This can happen either because of the insufficient operating system resources or if using HNQueue component (see AllocItems).
HNERR_ADAPTER_THREAD_ERRPacket Sniffer SDK internal thread creating error.
HNERR_TOO_BIG_PACKETS_POOLPackets pool size set in the PacketPool property is too big for this system.

Description:

Use OpenAdapter method to open the network adapter. After OpenAdapter has been executed successfully you can capture the network traffic using the OnPacketReceive event handler.

If ReceiveQueue property has been set before the network adapter opening, then traffic processing will be executed by HNQueue component.

Also you can:

On executing OpenAdapter method HNAdapter component attempts to close the network adapter which was opened earlier. So, one instance of HNAdapter object can open only one network device.

If you want to open several network adapters corresponding to different network cards, or to open the same network adapter several times, you should create several HNAdapter objects and set different or the same HNAdapterConfig objects for them using ConfigHandle property.

See also:HNAdapter, HNAdapterConfig, ConfigHandle, OnPacketReceive, UpdateUserStatistics, UpdateAdapterStatistics, Get_AsyncStatistics, OnStatistics, OnStateChange, SyncSend, AsyncSend