Packet Sniffer SDK DLL Edition

HNAdapter :: Methods :: AdpOpenAdapter

 Previous Next

Opens the network adapter.

Syntax:

DWORD __stdcall AdpOpenAdapter(HANDLE hAdp);

Parameters:

hAdp

[in] HNAdapter object handle.

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 [Get/Set] 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 QueAllocItems).
HNERR_ADAPTER_THREAD_ERRPacket Sniffer SDK internal thread creating error.
HNERR_TOO_BIG_PACKETS_POOLPackets pool size set in the AdpSetPacketPool property is too big for this system.
HNERR_INVALID_HANDLEhAdp parameter is not the HNAdapter object handle.

Description:

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

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

Also you can:

On executing AdpOpenAdapter function 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 [Get/Set] property.

See also:HNAdapter, HNAdapterConfig, AdpGetConfig, AdpSetConfig, AdpGetReceiveQueue, AdpSetReceiveQueue, OnPacketReceive, AdpUpdateUserStatistics, AdpUpdateAdapterStatistics, AdpGetAsyncStatistics, OnStatistics, OnStateChange, AdpSyncSend, AdpAsyncSend