Ağ daki Bilgisayarlara Ping Atmak

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdRawBase, IdRawClient,
IdIcmpClient, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
IdIcmpClient1: TIdIcmpClient;
host: TEdit;
Button1: TButton;
Label1: TLabel;
ekran: TListBox;
Timer1: TTimer;
ysure: TEdit;
zasim: TEdit;
Label5: TLabel;
CheckBox1: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure IdIcmpClient1Reply(ASender: TComponent; const AReplyStatus: TReplyStatus);
procedure Timer1Timer(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
host.Text:=’172.17.24.172′;
IdIcmpClient1.TTL:=9;
ysure.Text:=’3000′;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ekran.Clear;
IdIcmpClient1.Host:=HOST.Text;
IdIcmpClient1.ReceiveTimeout:=strtoint(zasim.text);
IdIcmpClient1.Ping();
end;

procedure TForm1.IdIcmpClient1Reply(ASender: TComponent; const AReplyStatus: TReplyStatus);
var
veri,ipadres,ttlsi,sure:string;
begin
case areplystatus.ReplyStatusType of
rsecho:
begin
veri:=inttostr(areplystatus.BytesReceived);
ipadres:=areplystatus.FromIpAddress;
ttlsi:=inttostr(areplystatus.TimeToLive);
sure:=inttostr(areplystatus.MsRoundTripTime);
ekran.Items.Add(ipadres+’ Cevabı: Byte=’+veri+’ Süre=’+sure+’ TTL=’+ttlsi);
end;
rstimeout: ekran.Items.Add(‘İstek zaman aşımına uğradı’);
else       ekran.Items.Add(‘Hedef Ağa Ulaşılamadı..’);
end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if length(host.Text)<1 then IdIcmpClient1.Host:=host.Text;
IdIcmpClient1.Ping();
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then begin
ysure.Enabled:=false;
Timer1.Interval:=strtoint(ysure.Text);
Timer1.Enabled:=true;
end else begin
ysure.Enabled:=true;
Timer1.Enabled:=false;
end;

end;

end.

Alıntıdır.

Bir cevap yazın