![]() |
IP Adresse ermitteln
Hallo DP ' ler !
Ich hoffe ihr könnt mir helfen. Ich möchte gerne die eigene IP- Adresse im Netzwerk herausbekommen. PS: Wenn möglich, ohne die Indy- Komponenten. Vielen Dank im Vorraus ! |
Re: IP Adresse ermitteln
Hilft das
![]() |
Re: IP Adresse ermitteln
Hallo,
hier eine der Möglichkeiten:
Delphi-Quellcode:
uses
WinSock; function IPAdress:String; const sTxtIP = '%d.%d.%d.%d'; var rSockVer : Word; aWSAData : TWSAData; szHostName : array[0..255] of Char; pHE : PHostEnt; begin Result:=''; // WinSock Version 1.1 initialisieren rSockVer:=MakeWord(1, 1); WSAStartup(rSockVer, aWSAData ); try FillChar(szHostName, SizeOf(szHostName), #0); GetHostName(szHostName, SizeOf(szHostName)); pHE:=GetHostByName(szHostName); if (pHE<>nil) then with pHE^ do Result:=Format(sTxtIP, [Byte(h_addr^[0]), Byte(h_addr^[1]), Byte(h_addr^[2]), Byte(h_addr^[3])]); finally WSACleanup; end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:37 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz