Autor Beitrag
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: So 27.03.05 12:55 
hi wie mache ich das am leichtesten den
server an pingen und wen der server online ist soller
der listbox1 item grün sein und wenn offline dann rot.


mit was pinge ich muß leicht und schnell gehen :)

Danke für eure posts

MFG sauger chris
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: So 27.03.05 13:37 
dafür nimmst du die richedit kompo:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
procedure TPing1.IdIcmpClient1Reply(ASender: TComponent;
  const AReplyStatus: TReplyStatus);
var
  sTime: string;    
  IP,BYTES, TTL, TIME : string;
begin
  
  IdIcmpClient1.ReceiveTimeout := TimeoutSpinEdit.Value;
  IdIcmpClient1.BufferSize := SizeSpinEdit.Value;


  if AReplyStatus.MsRoundTripTime = 0 then begin
    sTime := '<1'
  end else begin
    sTime := '=';
  end;

  {WriteLn(Format('%d bytes from %s: icmp_seq=%d ttl=%d time%s%d ms',
   [ReplyStatus.BytesReceived, ReplyStatus.FromIpAddress, ReplyStatus.SequenceId
   , ReplyStatus.TimeToLive, sTime, ReplyStatus.MsRoundTripTime]));}


  IP := Format('%s', [AReplyStatus.FromIpAddress]) ;
  BYTES := Format('%d', [AReplyStatus.BytesReceived]);
  TTL :=  Format('%d', [AReplyStatus.TimeToLive]);
  TIME := Format('%d', [AReplyStatus.MsRoundTripTime]);

 if BYTES <> '0' then begin
    with RichEdit1 do begin
      SelStart:= Length(RichEdit1.Text);
      SelAttributes.Color:= clLime;
      Lines.Add(TimeToStr(NOW)+' Antwort von '+IP+': Bytes='+BYTES+' Zeit='+TIME+'ms TTL='+TTL);
      Application.ProcessMessages;
      end;
  end;

  if BYTES = '0'  then begin
    with RichEdit1 do begin
      SelStart:= Length(RichEdit1.Text);
      SelAttributes.Color:= clSilver;
      Lines.Add(TimeToStr(NOW)+' Zeitüberschreitung der Anforderung für '+IdIcmpClient1.Host);
      Application.ProcessMessages;
    end;
  end;


end;


ist nen bischen code von mir aus nen alten tool, wird dir schon helfen...

gruß