Packet Sniffer SDK DLL Edition

HNFileAdapter :: Methods :: FAdpSyncSend

 Previous Next

Write packet to CAP file asynchronously.

Syntax:

DWORD __stdcall FAdpSyncSend(HANDLE hFAdp, LPVOID pPacket, DWORD PacketSize);

Parameters:

hFAdp

[in] HNFileAdapter object handle.

pPacket

[in] A pointer to a packet.

PacketSize

[in] The packet size.

Return values:

HNERR_OKThe packet has been written successfully.
HNERR_ADAPTER_NOT_OPENEDThe CAP file has not been opened, see the FAdpCreateFile function.
HNERR_ADDR_ERRpPacket has the wrong value (a memory write error).
HNERR_INCOMPATIBLE_MODEIncompatible mode of HNFileAdapter. Occurs when HNFileAdapter.AutoMode was set [Get/Set]), or if the CAP file was opened for data writing (see FAdpCreateFile function).
HNERR_WRITE_FILEFile write error.
HNERR_INVALID_HANDLEhFAdp parameter is not the HNFileAdapter object handle.

Description:

After successful creation of CAP file by FAdpCreateFile function you may dump packets to it by this function synchronously.

Example of writing packets to CAP file with FAdpSyncSend:

// Create HNPacket object
HANDLE hPkt = PktCreate(1514); 
LPVOID pPacketData = PktGetPacketData(hPkt); 
// Write data to the packet buffer
...

// Create CAP file
DWORD Res = FAdpCreateFile(hFAdp, "packets.cap");
...

// Write packet to file
Res = FAdpSyncSend(hFAdp, pPacketData, 1514);
See also:HNFileAdapter, FAdpCreateFile, FAdpSyncSendEx, HNFileAdapter.AutoMode