source: trunk/Packages/synapse/source/demo/scan/PingThread.pas

Last change on this file was 2, checked in by chronos, 12 years ago
  • Přidáno: Základní kostra projektu.
  • Přidáno: Knihovna synapse.
File size: 888 bytes
Line 
1unit PingThread;
2
3interface
4
5uses Classes, PingSend, IPUtils;
6
7type
8 PPingResult = ^TPingResult;
9 TPingResult = Record
10 IPAdress:String;
11 Exists:Boolean;
12 end;
13
14
15type
16 TPingThread = class(TThread)
17 private
18 { Private declarations }
19 protected
20 procedure Execute; override;
21 public
22 PingResult:TPingResult;
23 Ready:Boolean;
24 constructor Create(Ping:TPingResult);
25 end;
26
27implementation
28
29{ TPingThread }
30
31constructor TPingThread.Create(Ping:TPingResult);
32begin
33 PingResult.IPAdress := Ping.IPAdress;
34 inherited Create(False);
35end;
36
37procedure TPingThread.Execute;
38var Ping:TPingSend;
39begin
40 Ready := false;
41 Ping := TPingSend.Create;
42 Ping.Timeout := 2000;
43 PingResult.Exists := Ping.Ping(PingResult.IPAdress);
44 Ping.Free;
45 Ready := true;
46end;
47
48end.
Note: See TracBrowser for help on using the repository browser.