All pastes #4037 Raw Edit

TJ

public text v1 · immutable
#4037 ·published 2005-01-11 09:57 UTC
rendered paste body
unit Unit1;

interface

uses
  Classes, idGlobal, ExtCtrls, IdBaseComponent, IdComponent,
  IdTCPConnection, IdTCPClient, IdException, Windows, SysUtils, Controls,
  StdCtrls, Forms;


type
  TForm1 = class(TForm)
    C: TIdTCPClient;
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var R : Boolean;
 i : integer;
  ip : string;
  DateTime : TDateTime;

begin
  DateTime := Time;
  memo1.Lines.add(TimeToStr(DateTime));

  for i := 1 to 255 do
  begin
      R := false;
      try
        Ip := '10.0.0.'+inttostr(i);
        C.ReadTimeout := 5;
        C.Host := Ip;
        C.Connect();
        try
          R := true;
          C.Disconnect;
        except
          on E : EIDException do
          begin

          end;
          on E : Exception do
          begin

          end;
        end;
      except
          on E : EIDException do
          begin

          end;
          on E : Exception do
          begin

          end;
      end;
      DateTime := Time;
      memo1.lines.Add(IP + ', ' + Inttostr(integer(R)) + ' : ' + TimeToStr(DateTime)  );
      Application.processMessages();
  end;
end;

end.