Hi,
I am using this function to ping a sequence of IP addresses every 5 sec in
the following way:
repeat
result:=real_ping(IP1
..)
result:=real_ping(IP2
..)
result:=real_ping(IP3
..)
sleep(5000)
until false
In case of error the function prints the IP, ReplyFrom and Error
Description.
What is troubling me is this:
- occasionally the function prints the preceeding IP in the sequence as
"ReplyFrom" in case of error
- example: while pinging IP3 I get sometimes error result: ERROR IP3 : IP2 :
How is this possible as I call RealPingSend.Destroy in the finally clause?
I also tried RealPingSend.Free; FreeAndNil(RealPingSend);
The result is the same.
----------------------------------------------------------------------------
-------------------------------
function real_ping(IP:string; TTL,TMOUT:integer):boolean;
var s:string; r:boolean;
begin
RealPingSend := TPINGSend.Create;
Result:=false;
RealPingSend.TTL:=TTL;
RealPingSend.Timeout:=TMOUT;
RealPingSend.PacketSize:=16;
try
r:=RealPingSend.Ping(IP);
s:=RealPingSend.ReplyFrom;
if r and (s=IP) then Result:=true else writeln('ERROR : ',IP,' : ',s,'
: ',RealPingSend.ReplyErrorDesc);
finally
RealPingSend.Destroy;
//FreeAndNil(RealPingSend);
//RealPingSend.Free;
end;
//sleep(30);
end;
----------------------------------------------------------------------------
-------------------------------
Thank you for advice
Mit freundlichem Gruß / Yours sincerely / Cordialement
Christian Sporer
Grüntenstr.18
80686 München
Tel.: +(49) 89 54217952
Fax.: +(49) 89 52389119
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public