Autor Beitrag
mtin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 177

Win XP SP2
BDS2006 Enterprise
BeitragVerfasst: So 15.05.05 23:22 
es gibt ja zahlreiche php-scripts,
die überprüfen ob ein server auf einem bestimmten port online ist oder nicht.

z.b. mtin.5gigs.com/statu...w.delphi-forum.de:80
wenn man dies auf port 81 abändert, so steht offline da (als bild)
mtin.5gigs.com/statu...w.delphi-forum.de:80

genau das gleiche würde ich gerne in einem delphi-programm machen, also überprüfen ob online oder nicht un dann eben eins der beiden Bilder darstellen.

allerdings hab ich nicht die geringste ahnung wie das php-script überhaupt funktioniert, und erst recht nicht wie ich das mit delphi gestalten könnte!

kann mir da jemand helfen?
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 16.05.05 00:01 
versuch mal an das PHP script ranzukommen... aber einich is das recht einfach. ich glaube, du kommst schon weiter mit den Indy komponenten und Suche in: Delphi-Forum, Delphi-Library PING...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 16.05.05 00:06 
wenn du über die indy-komponenten verfügst, kannst du ganz einfach per TCP-Client versuchen dich über einen bestimmten port mit der ip adresse zu connecten. falls das gelingt, ist der server da.
wenn nicht, ist entweder kein server da, oder der port wird geblockt.
in quelltext würde das dann so aussehen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
    IdTCPClient1.Host:=192.168.87.98;   
    IdTCPClient1.Port:=999;
    IdTCPClient1.Connect;   
    if IdTCPClient1.Connected then   
    begin
      //JUHUUU es geht
    end
    else
    begin
      //ohhh, niemand zuhause
    end;   
    IdTCPClient1.Disconnect;

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
mtin Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 177

Win XP SP2
BDS2006 Enterprise
BeitragVerfasst: Mo 16.05.05 00:09 
hmm hab jetzte das mit nem "IdTCPClient" versucht...:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm2.Button10Click(Sender: TObject);
begin
IdTCPCLient1.ConnectTimeout:=100;
IdTCPCLient1.Host:=Edit9.Text;
IdTCPCLient1.Port:=StrToInt(Edit10.Text);
IdTCPCLient1.Connect;
if IdTCPCLient1.Connected then begin showmessage('verbunden'); end else begin showmessage('kann nich verbinden'); end;
IdTCPCLient1.DisConnect;
end;


klappt auch soweit der server an is, sobald ich ihn ausmache kommen 2 exeptions und dann nen timeout error und nicht mein fenster.... :?

EDIT: also erst kommt die erste exeption lautet "Socket error # 10038 Socket operation on non-socket", die 2. "connect timed-out" und dann komtm noch nen normales fenster meines programms mit "connect timed-out", aber meine showmessage "kann nich verbinden" kommt nich.....
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 16.05.05 00:14 
meine indy streiken grad. ich habs auas dem kopf programmiert.
die exeptions werden wohl bei IdTCPCLient1.Connect; kommen (so denn sonst) ^^.
versuchs mal mit try-finally abzufangen :nixweiss:

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 16.05.05 00:14 
pack mal das connect in ne try, dann die showmessage unter except...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 16.05.05 00:23 
ohh, du hast deinen beitrag bearbeitet.
dieser fehlercode wird von winsock ausgelöst
weitere infos:
"Suche bei Google SOCKET OPERATION ON NON-SOCKET":
www.microsoft.com/re...s/w2000Msgs/3124.asp

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
mtin Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 177

Win XP SP2
BDS2006 Enterprise
BeitragVerfasst: Mo 16.05.05 00:25 
ok, danke!
klappt jetzt....

zumindest wenn ichs ohne den debugger starte, der meckert immer noch über 2 exceptions^^
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 16.05.05 13:58 
try - except - end blöcke werden vom Programm selber zwar so ausgeführt, dass fehler unterdrückt werden, der debugger aber zeigt dir trotzdem noch, wo die exceptions liegen. das ist absicht und eigenlich auch ein vorteil.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.