Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
New related comments Number of comments in the last 48 hoursPlay WAV files 1 new comments
|
Detect your own IP Address
6 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Note:
If you run through NAT then your public address can only be told by someone else like:
http://www.myip.dk/
 | |  | | uses
WinSock;
function My_IP_Address : longint;
var
buf : array [0..255] of char;
RemoteHost : PHostEnt;
begin
Winsock.GetHostName(@buf, 255);
RemoteHost:=Winsock.GetHostByName(buf);
if RemoteHost=NIL then
My_IP_Address := winsock.htonl($07000001)
else
My_IP_Address := longint(pointer(RemoteHost^.h_addr_list^)^);
Result := Winsock.ntohl(Result);
end; | |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
|
|
|
|
hi
|
|
|
|
|
hi
|
|
|
|
|
Well done!!!
|
2007-01-11, 15:23:22 (updated: 2007-01-11, 15:29:45) |
|
|
|
it always returns 127.0.0.1
|
|
|
|
|
great
|
|
|
|
|
test
|
|