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