Main Logo
Articles   Members Online:
-Article/Tip Search
-News Group Search over 800,000 Borland news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Delphi: Function To Get Your IP Address
Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Function To Get Your IP Address Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
20-Jul-04
Category
Internet / Web
Language
Delphi All Versions
Views
801
User Rating
6
# Votes
5
Replies
1
Publisher:
Turner, Clayton
Reference URL:
			1   
2   uses 
3     Winsock; 
4   
5   {...} 
6   
7   function getIPs: Tstrings; 
8   type 
9     TaPInAddr = array[0..10] of PInAddr; 
10    PaPInAddr = ^TaPInAddr; 
11  var 
12    phe: PHostEnt; 
13    pptr: PaPInAddr; 
14    Buffer: array[0..63] of Char; 
15    I: Integer; 
16    GInitData: TWSAData; 
17  begin 
18    WSAStartup($101, GInitData); 
19    Result := TstringList.Create; 
20    Result.Clear; 
21    GetHostName(Buffer, SizeOf(Buffer)); 
22    phe := GetHostByName(buffer); 
23    if phe = nil then Exit; 
24    pPtr := PaPInAddr(phe^.h_addr_list); 
25    I    := 0; 
26    while pPtr^[I] <> nil do 
27    begin 
28      Result.Add(inet_ntoa(pptr^[I]^)); 
29      Inc(I); 
30    end; 
31    WSACleanup; 
32  end; 
33  
34  {Example of use:}
35  
36  procedure TForm1.Button1Click(Sender: TObject); 
37  begin 
38    ShowMessage('Your IP Address is: ' + GetIps; 
39  end; 


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC
Advertisement


Share this page
Advertisement
Copyright © 2024 by No Limit Solutions LLC