Autor Beitrag
tmkb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Di 06.08.02 17:51 
Hallo,

weiß jemand wie ich am einfachsten einen Host (keine IP, sondern eine domain) anpingen kann, um die IP zu bekommen? also in einem edit1 steht zB 'microsoft.com' und dann gibt er in edit2 die IP an, oder schreibt in Edit2 halt "konnte Host nicht anpingen" rein, wenn der host nicht antwortet....
danke
tmkb
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Di 06.08.02 17:59 
Haste die FastNetKomponenten??? Wenn ja, guck dir mal die Komponente TNMFinger an. Damit müsste das funktionieren. Bin mir aber nicht sicher :wink: Musst halt mal ausprobieren und wenn es nicht klappt nochmal fragen :wink:

_________________
Viele Grüße
Jakob
tmkb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Di 06.08.02 18:09 
alsó ich hab schon die fastnet kompos, ich hätte sogar auch die Indy Kompos, aber ich weiß ja nicht wie ich die in dem fall richtig anwende?
Martin
Hält's aus hier
Beiträge: 9



BeitragVerfasst: Fr 09.08.02 21:30 
Hi,

ich habe zwar keine der Komponenten, aber so sollte es auch gehen...

Martin

ausblenden volle Höhe 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:
uses winsock;

//...

procedure TForm1.Button1Click(Sender: TObject);

var addr : TInaddr;
var hostEntry : pHostEnt;
    wsdata : TWSAData;
    fLasterr : integer;
    fHandle : THandle;
    winsockOK : boolean;
begin
     richedit1.Lines.Clear;
     fLasterr := WSAStartup(makeWord(1,1), wsdata);
     case fLasterr of
      WSAEINVAL,
      WSASYSNOTREADY,
      WSAVERNOTSUPPORTED : winsockOK := false;
     else winsockOK := true;
     end;
     if winsockOK then
     begin
          fhandle := AllocateHWnd(WndProc);
          richedit1.Lines.Add('Ready...');
     end;
     getmem(hostEntry, MAXGETHOSTSTRUCT);
     richedit1.lines.add('--------------------------------------');
     hostentry := getHostbyName(pchar(edit1.text));
     if hostentry <> nil then
     begin
          richedit1.Lines.Add('looking up for Host : ' + hostentry.h_name);
          addr := PInaddr( hostentry^.h_addr_list^)^;
          richedit1.lines.add('IP : ' + inet_ntoa(addr));
     end
     else
     begin
          richedit1.Lines.Add('lookup failed for '+edit1.text);
     end;
end;

end;
tmkb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Sa 10.08.02 08:08 
danke!