Autor Beitrag
Shadowdragon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 143

Win 2000
Delphi 6 Pers., Delphi 7
BeitragVerfasst: Fr 28.03.03 19:26 
Nochmal eine Noob-Frage:

Mit welchem Befehl kann ich denn in Delphi einen Hostname zu einer IP konvertieren (notfalls auch mit Indy)?

Als Eingabe nehm ich mal edit1 für die IP und edit2 für die URL...

Danke schonmal im Voraus ^__^

_________________
Ein Programm gleicht dem Prinzip von Jenga:
Viele Bestandteile, wird nach oben hin immer besser, nach unten hin immer instabiler und wenn man was falsch macht klappt der ganze Mist zusammen.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 28.03.03 19:59 
um einen namen im lokalen netzwerk umzuwandeln hab ich im EDH folgenden code gefunden:
ausblenden 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:
Uses
  WinSock;

FUNCTION GetIpAddressByName(const AComputerName: STRING): STRING;
VAR
  TMPResult: STRING;
  WSA: TWSAData;
  H: PHostEnt;
  P: PChar;
BEGIN
  IF WSAStartUp($101, WSA) = 0 THEN
    BEGIN
      GetMem(P,255 + 1);
      StrPCopy(P, ComputerName);
      H:=GetHostByName(P);
      FreeMem(P);
      IF H <> NIL THEN
        BEGIN
          P:=inet_ntoa(PInAddr(H^.h_addr_list^)^);
          TMPResult:=StrPas(P)
        END;
      WSACleanUp;
      IF TMPResult <> '' THEN
        Result:=TMPResult
      ELSE
          Result:= '0';
    END;
END;


wenn du z.b. aaa.auq.de aufgelöst haben willst, dann ping doch einfach per INDY. dann bekommst du die IP zurück

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Shadowdragon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 143

Win 2000
Delphi 6 Pers., Delphi 7
BeitragVerfasst: So 30.03.03 17:06 
Funzt, danke ^___^

_________________
Ein Programm gleicht dem Prinzip von Jenga:
Viele Bestandteile, wird nach oben hin immer besser, nach unten hin immer instabiler und wenn man was falsch macht klappt der ganze Mist zusammen.