i want to find my IP.
(sure with masm32)
Posted on 2003-08-20 14:04:28 by Criminal2
It's simple, get the IP of the domain name "localhost", works in every programming languaje (that supports sockets) in any Windows version... :)
Posted on 2003-08-20 18:18:19 by QvasiModo
Don't you know it?

127.0.0.1

:grin: :grin: :grin:
Posted on 2003-08-20 21:57:04 by JimmyClif

It's simple, get the IP of the domain name "localhost", works in every programming languaje (that supports sockets) in any Windows version... :)

i was try that but it is not worked...
inet_ntoa(inet_addr("localhost"))
th return value is "255.255.255.255"
Posted on 2003-08-21 01:48:47 by Criminal2
Posted on 2003-08-21 04:09:45 by Hiroshimator

Don't you know it?

127.0.0.1

:grin: :grin: :grin:

I presume you are joking :grin:
However, it's a way to know if you're connected to the internet or not. Attempting to retrieve the address of localhost returns 127.0.0.1 if not connected, and my real IP if I am (at least at home I've seen it work so... I have Win98 and a dialup connection).
Posted on 2003-08-21 19:01:01 by QvasiModo


i was try that but it is not worked...
inet_ntoa(inet_addr("localhost"))
th return value is "255.255.255.255"

I think you should lookup "localhost" as if it were a domain name...
Posted on 2003-08-21 19:01:45 by QvasiModo
it's a way to know if you're connected to the internet or not. Attempting to retrieve the address of localhost returns 127.0.0.1 if not connected


ya that's right but only on dialup connections, but if any one using DSL, ISDN or any Internet line technology it will not work if u want to detect the internet use :

InternetGetConnectedState;
it work for types of connections

amr
Posted on 2003-08-23 07:17:14 by amr
To see what your ip is, run winipcfg.
Posted on 2003-08-23 09:17:04 by djinn
Hi
To see what your ip is, run winipcfg.


LOL

To find out your ip, Ping www.google.com, run ipconfig, or even better call your ISP & they will tell you..

sorry guys I had to comment:grin:

Peace
Posted on 2003-08-23 09:34:47 by mistronr1

Hi


LOL

To find out your ip, Ping www.google.com, run ipconfig, or even better call your ISP & they will tell you..

sorry guys I had to comment:grin:

Peace

mistronr1 's IQ=60
Posted on 2003-08-23 09:52:16 by Criminal2
ok example:



; #################################################

.486
.model flat, stdcall
option casemap :none ; case sensitive

; #################################################

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
include \masm32\include\wsock32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\wsock32.lib

.data
myhostname db "localhost",0
.data?
wdat WSADATA <?>
getip PROTO

; #################################################
.code

start:

call getip
invoke ExitProcess,0

; #################################################

getip proc
invoke WSAStartup,101h,addr wdat

invoke gethostbyname,addr myhostname

mov eax, DWORD PTR [eax+12]
mov eax, DWORD PTR [eax]
mov eax, DWORD PTR [eax]

invoke inet_ntoa,eax

invoke MessageBox,0,eax,addr myhostname,MB_OK

invoke WSACleanup
ret
getip endp

; #################################################
end start
Posted on 2003-08-24 02:30:49 by RobotBob