我试过如下写法,报告errorcode=50,不能发送arp包。
也试过参数4用dword,errorcode=87。
所以想请教一下写法,谢谢
Function sendarp(ipaddr:ulong;
temp:dword;
ulmacaddr
ointer;
ulmacaddrleng
ointer) : DWord; StdCall;
implementation
{$R *.DFM}
Function sendarp; External 'Iphlpapi.dll' Name 'SendARP';
procedure TForm1.Button1Click(Sender: TObject);
var
myip:ulong;
mymac:array[0..5] of byte;
mymaclength:ulong;
r:integer;
begin
myip:=inet_addr(PChar('10.0.0.1'));
mymaclength:=length(mymac);
r:=sendarp(myip,0,@mymac,@mymaclength);
label1.caption:='errorcode:'+inttostr(r);
label2.caption:=format('%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x',[mymac[0],mymac[1],mymac[2],mymac[3],mymac[4],mymac[5]]);
end;