/synapse/source/demo/scan/PingThread.pas
Pascal | 48 lines | 36 code | 10 blank | 2 comment | 0 complexity | a6e8ec05bb2a18ab3e4fc9b4c7525330 MD5 | raw file
Possible License(s): BSD-3-Clause
- unit PingThread;
-
- interface
-
- uses Classes, PingSend, IPUtils;
-
- type
- PPingResult = ^TPingResult;
- TPingResult = Record
- IPAdress:String;
- Exists:Boolean;
- end;
-
-
- type
- TPingThread = class(TThread)
- private
- { Private declarations }
- protected
- procedure Execute; override;
- public
- PingResult:TPingResult;
- Ready:Boolean;
- constructor Create(Ping:TPingResult);
- end;
-
- implementation
-
- { TPingThread }
-
- constructor TPingThread.Create(Ping:TPingResult);
- begin
- PingResult.IPAdress := Ping.IPAdress;
- inherited Create(False);
- end;
-
- procedure TPingThread.Execute;
- var Ping:TPingSend;
- begin
- Ready := false;
- Ping := TPingSend.Create;
- Ping.Timeout := 2000;
- PingResult.Exists := Ping.Ping(PingResult.IPAdress);
- Ping.Free;
- Ready := true;
- end;
-
- end.