uses IdBaseComponent, IdComponent, IdRawBase, IdRawClient, IdIcmpClient
//
procedure TForm1.IdIcmpClient1Reply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
var
sTime: String;
begin
if (AReplyStatus.MsRoundTripTime = 0) then
sTime := '< 1'
else
sTime := '=';
Listbox1.Items.Add(Format('%d Bytes from %s: ICMP_Seq = %d TTL = %d Time %s%d (ms)',
[AReplyStatus.BytesReceived,
AReplyStatus.FromIpAddress,
AReplyStatus.SequenceId,
AReplyStatus.TimeToLive,
sTime,
AReplyStatus.MsRoundTripTime]));
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
IdIcmpClient1.Host := '192.168.0.1';
for i := 1 to 4 do
begin
IdIcmpClient1.Ping;
Application.ProcessMessages;
end;
end;
Keine Kommentare:
Kommentar veröffentlichen