|
Internet IP Address behind Router/Firewall
|
Email
|
| Submitted on: |
8/18/2004 1:39:34 PM |
| By: |
Khalid A.
|
| Level: |
Beginner |
| User Rating: |
By 8 Users |
| Compatibility: |
Delphi 7 |
| Views: |
23377 |
|
(About the author) |
|
|
|
Internet IP Address behind Router/Firewall
|
| |
Terms of Agreement:
By using this article, you agree to the following terms...
- You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
- You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
- You may link to this article from another website, but ONLY if it is not wrapped in a frame.
- You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
|
Getting your real Internet-IP-Address when you are behind a router or using adsl proxy is simple way using indy IdHTTP components shipped with Delphi 7 to pares Perl/Cgi page to get the return IP Address.
Just Drop Edit box on a Form with button and IdHTTP then place this code :
var
i:integer;
x,s:ansistring;
begin
try
x:=IdHTTP1.Get('http://checkip.dyndns.org');
i:= AnsiPos('Address:',x);
i:=i+9;
while x[i]<>'<' do begin
s:=s+x[i];
inc(i);
end;
Edit1.Text:=s;
finally
end;
end;
|
|
Other 1 submission(s) by this author
|
|
Report Bad Submission
|
Your Vote
|
| |
Other User Comments
|
8/18/2004 8:55:34 PM:
Sir, what's is useful to know our real IP Address in our program? Thanks.. (If this comment was disrespectful, please report it.)
|
8/19/2004 12:37:53 AM: www.loveboard.tk
good one. appreciated :) (If this comment was disrespectful, please report it.)
|
8/19/2004 2:02:03 PM: Ian Fain.
I guess there is no real way to do, except by visiting a website and having PHP tell you. (If this comment was disrespectful, please report it.)
|
8/20/2004 8:13:47 AM: Christer Bru
Why this is useful: if you are going to set up a server, and have a remote computer to connect to it, you must know your ip address. Do you know another way to do this? Maybe using winsock? because im limited to Delphi 6 components... Thanks in advance. (If this comment was disrespectful, please report it.)
|
8/23/2004 12:51:32 PM: Jerome Scott II
Acutally delphi 6 componets are better. Delphi 7 is based of .NET so its a big change most people don't like it. Im staying with d6 (If this comment was disrespectful, please report it.)
|
11/18/2004 9:43:27 AM:
god (If this comment was disrespectful, please report it.)
|
4/20/2006 3:19:43 AM:
Thank you for this code. (If this comment was disrespectful, please report it.)
|
6/29/2006 8:21:00 AM: engin
güzel (If this comment was disrespectful, please report it.)
|
8/21/2006 5:15:47 PM: mahin
Hi.I have one question.if I work with webconnection,it need servername in property.what is this?for example for yahoo!thank you. (If this comment was disrespectful, please report it.)
|
1/28/2007 2:12:53 AM: Zeuspelink
Put WinSock @ Uses Clause then Copy N paste this code
function My_IP: string; type TaPInAddr = array [0..10] of PInAddr; PaPInAddr = ^TaPInAddr; var phe: PHostEnt; pptr: PaPInAddr; Buffer: array [0..63] of char; i: Integer; GInitData: TWSADATA; begin WSAStartup($101, GInitData); Result := ''; GetHostName(Buffer, SizeOf(Buffer)); phe :=GetHostByName(buffer); if phe = nil then Exit; pptr := PaPInAddr(Phe^.h_addr_list); i := 0; while pptr^[i] <> nil do begin result:=StrPas(inet_ntoa(pptr^[i]^)); Inc(i); end; WSACleanup; end;
Found this on the net somewhere don't remember where but it's very usefull. (If this comment was disrespectful, please report it.)
|
9/8/2007 11:07:10 AM: k4ck
good (If this comment was disrespectful, please report it.)
|
2/2/2008 8:53:32 AM:
- - (If this comment was disrespectful, please report it.)
|
12/15/2008 2:34:15 AM: asfsdf
sdfsafsd (If this comment was disrespectful, please report it.)
|
12/19/2008 3:28:08 PM: i need help about firewall
hello sir. i am a new delphi user. i really need help to code afire wall for our professor in university . im in great need of help . can u code a sample program. i appriciate your help . thanks . (If this comment was disrespectful, please report it.)
|
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)
To post feedback, first please login.
|