tommy916
18th August 2004 20:44 UTC
how to get user's IP address
Does anyone know how to get the IP address when they are online while they install? I'm looking at ipdll.zip but i don't know how to use it. If anyone could write a small code to get ip address, that would be great.
thanks
Tommy
Comm@nder21
18th August 2004 21:57 UTC
use this plugin from lobo lunar instead. it has sample code attached.
Takhir
19th August 2004 13:37 UTC
BTW some comps have few IPs :)
Comm@nder21
20th August 2004 11:32 UTC
the plugin from lobo lunar includes multiple functions for the different ip's. (local & global)
Takhir
20th August 2004 12:58 UTC
May be. Internet.zip includes internet.nsi sample, it's package output shown below in comparision with ipconfig:
D:\>ipconfig
Windows 2000 IP Configuration
Ethernet adapter amass_net:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 198.99.86.xxx
Subnet Mask . . . . . . . . . . . : 255.255.255.224
Default Gateway . . . . . . . . . : 198.99.86.xxx
PPP adapter cnt:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 212.15.120.xxx
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 212.15.120.xxx
Executing plugin....
Version: 2.0
My IP: 198.99.86.xxx
My Host Name: sco
The URL returns: 200
Plugin done.
Completed
No sources in Internet.zip 4 files only (I know how to get IPs, but srcs might help to understand this situation). Or detailed help file ( Internet.chm - :) :) ) I guess docs - not a strong side of NSIS dev. group :) . For example NSIS:
4.9.1.5 File
[/nonfatal] [/a] ([/r] (file|wildcard) [...] | /oname=file.dat infile.dat)
Compare to MSDN good style (first page I opened):
#elif
Syntax
#elif constant-expression
Joel
20th August 2004 14:54 UTC
@Takhir: I'm not that pro in development. I made the IP function as an alternative to the ipconfig.
Yes, mostly PC have more than IP address, but mostly the user want to know the main IP, the broadcasting one.
Now, thanks for your opinion, maybe in the future I'll add the output way (like ipconfig).
deguix
20th August 2004 21:21 UTC
Now, thanks for your opinion, maybe in the future I'll add the output way (like ipconfig).
Hmmm... I don't think that's a good idea. It's better to have several DLL functions for getting different types of IP addresses or a DLL function that has some parameters specifying the IP address type.
Outputting like command-line programs is much more complicated to manage as you need functions that manipulate strings, like StrStr.
Takhir
21st August 2004 09:15 UTC
gethostbyname -> HOSTENT.h_addr_list
"A NULL-terminated list of addresses for the host."
Function can push array of addresses (IPv4 DWORD) to stack. IMHO this is simplest way.
"IP version 6, denoted by AF_INET6" - next step :)