depends what IP your looking at hehee
there are any number of IP's you machine can have at once...
Local Machine
Local Network Card
Internet/Modem
Dynamic/Static Internet Service Provider
the only one that will really change is your ISP one, all the rest are static and you'll have to change them manually if you want then different to default
IP 1 - is your Machines
IP 2 - is your ISPs (or network if you have a network card)
sync on
if WSAStartup() = 0
print GetLocalIP(0)
print GetLocalIP(1)
WSACleanup()
endif
sync
sync
wait key
end
function GetLocalIP(index as integer)
local ip as string
local p as DWORD
local HOSTENT as DWORD
HOSTENT=make memory(256)
if GetHostName( HOSTENT, 256 ) = 0
HostInfo=GetHostByName( HOSTENT )
if HostInfo <> 0
p=HostInfo+12
p=*p
p=*p
p=p+(index*4)
ip=INET_ntoa( *p )
endif
endif
delete memory HOSTENT
endfunction ip
function GetHostName(memptr as DWORD, size as integer)
local r as integer
local a as DWORD
local s as DWORD
r=call dll(201, "gethostname", memptr, size)
endfunction r
function GetHostByName(memptr as DWORD)
local r as integer
r=call dll(201, "gethostbyname", memptr)
endfunction r
function INET_ntoa(addr as DWORD)
local ip as string
ip=call dll(201, "inet_ntoa", addr)
endfunction ip
function WSAStartup()
local WSADATA as DWORD
local r as integer
local v as WORD
load dll "wsock32.dll",201
WSADATA=make memory(16384)
v=2
r=call dll(201, "WSAStartup", v, WSADATA)
delete memory WSADATA
endfunction r
function WSACleanup()
call dll 201, "WSACleanup"
delete dll 201
endfunction
function GetLocalIPCount()
local Count as integer
local p as DWORD
local v as DWORD
local HOSTENT as DWORD
HOSTENT=make memory(256)
Count=0
if GetHostName( HOSTENT, 256 ) = 0
HostInfo=GetHostByName( HOSTENT )
if HostInfo <> 0
p=HostInfo+12
p=*p
do
v=*p
if v = 0 then exit
inc p, 4
inc Count
loop
endif
endif
delete memory HOSTENT
endfunction Count
Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?