DELPHI截取网络数据包 Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiNetwork/html/delphi_20061218101640102.html
用Delphi和wincap包中PacketReceivePacket函数接包时出现内存泄漏。
这是扫描什么原因?
var
recvbuf: array[0..1024*250 - 1] of char;
if not PacketSetBuff(lpAdapter,250*1024) then
begin
ShowMessage(Format('PacketSetBuff Error: %d',[GetLastError()]));
exit;
end;
if not PacketSetReadTimeout(lpAdapter,1) then
ShowMessage('Warning: Unable to set the timeout');
lppacketr := PacketAllocatePacket();
if lppacketr = nil then
begin
ShowMessage(Format('PacketAllocatePacket receive Error: %d',[GetLastError()]));
exit;
end;
PacketInitPacket(lppacketr,@recvbuf,sizeof(recvbuf));
while true do
begin
if not PacketReceivePacket(lpAdapter,lppacketr,true) then exit;
end;
用Delphi和wincap包中PacketReceivePacket函数接包时出现内存泄漏。
这是什么原因?