Packet Sniffer SDK VCL Edition
HNFileAdapter :: Methods :: SyncSend | | Previous Next |
Write packet to CAP file asynchronously.
Syntax:
function SyncSend(pPacket: Pointer; PacketSize : DWORD) : DWORD;
Parameters:
pPacket
[in] A pointer to a packet.
PacketSize
[in] The packet size.
Return values:
| HNERR_OK | The packet has been written successfully. |
| HNERR_ADAPTER_NOT_OPENED | The CAP file has not been opened, see the CreateFile function. |
| HNERR_ADDR_ERR | pPacket has the wrong value (a memory write error). |
| HNERR_INCOMPATIBLE_MODE | Incompatible mode of HNFileAdapter. Occurs when HNFileAdapter.AutoMode
was set, or if the CAP file was opened for data reading (see HNFileAdapter.OpenFile function). |
| HNERR_WRITE_FILE | File write error. |
Description:
After successful creation of CAP file by HNFileAdapter.CreateFile function
you may dump packets to it by this function synchronously.
Example of writing packets to CAP file with SyncSend:
// Create HNPacket object
HNPacket1 := HNPacket.Create();
HNPacket1.Handle := HNPacket1.AllocatePacket(1514);
pPacketData = HNPacket1.PacketData;
// Write data to the packet buffer
...
// Create CAP file
Res = HNFileAdapter1.CreateFile("packets.cap");
...
// Write packet to file
Res = HNFileAdapter1.SyncSend(pPacketData, 1514);