Autor Beitrag
fredyy
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Di 07.06.05 13:28 
hi,
ich bin noch sehr neu in delphi und habe deshalb große probleme.
ich würde gern wissen wie ich mit der indy komponente
abfragen kann ob sie online ist oder nicht und wie
lang die ping zeit ist. ich hoffe ihr könnt mir helfen.

bye fredyy
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 07.06.05 14:47 
Also erstmal :welcome: im DF!! ;)

user profile iconfredyy hat folgendes geschrieben:
ich würde gern wissen wie ich mit der indy komponente
abfragen kann ob sie online ist oder nicht

Ob die Komponente online ist? :eyes: Welche Komponente? Wie soll eine Komponente online sein? Ob sie erreichbar ist?

user profile iconfredyy hat folgendes geschrieben:
und wie lang die ping zeit ist. ich hoffe ihr könnt mir helfen.

Du willst also irgendwas anpingen?!? Schau mal nach der IdICMP-Komponente. ;) Suche in: Delphi-Forum, Delphi-Library IDICMP.
r4id3n
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 115

Win XP Home, Win XP Pro
D6 Prof, D7 Ent, K3 Ent
BeitragVerfasst: Di 07.06.05 14:55 
Hi, ich denke mal, dass du wissen willst, ob ein Rechner online ist!?
Hierfür kannst du die IdICMP-Komponente verwenden! Aber!!! Das geht nur mit Adminrechten, da die ICMP-Komponente RAW-Access braucht!

Bei den Beispielen gibts ein gutes ICMP Bsp!

Hoffe das hat geholfen ;-)
fredyy Threadstarter
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Di 07.06.05 17:40 
nein ob wie oben im titel die url oder die ip
online ist... und dann wenn sie online ist
will ich wissen wir hoch die pingzeit ist.
dein link funktioniert leider nicht.

bye fredyy
r4id3n
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 115

Win XP Home, Win XP Pro
D6 Prof, D7 Ent, K3 Ent
BeitragVerfasst: Di 07.06.05 17:43 
Wie schon gesagt, schau dir das ICMP Beispiel an! Und bitte lese vorher nochmal durch was du das schreibst beovr du auf Absenden drückst .... Da wird doch kein mensch schlau draus ;-)
r4id3n
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 115

Win XP Home, Win XP Pro
D6 Prof, D7 Ent, K3 Ent
BeitragVerfasst: Di 07.06.05 17:54 
Hab mal kurz was für dich gebastelt, da ich feststellen musste, dass es kein beispiel gibt :-(.
Läuft mit indy 10! zu bekommen bei www.indyproject.org

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure MeineMegaPingRoutine; // ;-)
var IdIcmpClient: TIdIcmpClient;
begin
  IdIcmpClient := TIdIcmpClient.Create(nil);
  idicmpClient.Host:='delphiforum.de'; // Eigene eintragen!

  try
    IdIcmpClient.Ping;
  except
    showmessage('Host nicht erreichbar!');
    IdIcmpClient.Free;
    exit;
  end;


  if idicmpclient.ReplyStatus.ReplyStatusType = rsEcho then
    showmessage('Reaktionszeit = ' + inttostr(IdIcmpClient.ReplyStatus.MsRoundTripTime) + ' ms')
  else
    showmessage('Host nicht erreichbar!');

  IdIcmpClient.Free;
end;
fredyy Threadstarter
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Do 09.06.05 06:48 
cool das funktion nier nur wenn ich
ausblenden Delphi-Quelltext
1:
  idicmpClient.Host:=Edit1.Text; // Eigene eintragen!					

mache bekomme ich nen fehler.
oder gibt es ne möglich keit das wie ne funktion aufzurufen?
also
ping(www.delpih-forum.de,80); wo bei 80 dann der port ist..
r4id3n
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 115

Win XP Home, Win XP Pro
D6 Prof, D7 Ent, K3 Ent
BeitragVerfasst: Do 09.06.05 08:32 
Sorry, aber wie wäre es, wenn du ein wenig selber überlegst? Aber ich will ja mal nicht so sein!

ausblenden 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:
function MeineMegaPingRoutine(Host:String;Port:Integer=0):Integer;
var IdIcmpClient: TIdIcmpClient;
begin
  IdIcmpClient := TIdIcmpClient.Create(nil);
  idicmpClient.Host:=Host;
  idicmpClient.Port:=Port;


  try
    IdIcmpClient.Ping;
  except
    result:=-1;
    IdIcmpClient.Free;
    exit;
  end;


  if idicmpclient.ReplyStatus.ReplyStatusType = rsEcho then
    result:=IdIcmpClient.ReplyStatus.MsRoundTripTime;
  else
    result:=-1;

  IdIcmpClient.Free;
end;


Obwohl ich glaube, dass du da mit Port was missverstehst! Du kannst zwar einen Port angeben, jedoch erfolgt nur der Ping auf diesen Port, dass dieser offen und erreichbar ist, ist wieder eine andere Frage.

Wenn du wissen willst, ob ein Webserver online ist, dann benutz die IdHTTP Komponente und mach ein

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
IdHTTP.requesttimeout:=10000;
try
IdHTTP.get(URL);
except
showmessage('Server nicht online!');
end;
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Do 09.06.05 11:38 
man kann übringens auch ohne das schwule indy pingen:
www.delphi-forum.de/..._api+ping_41030.html

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...