|
-
Aug 26th, 2001, 10:11 PM
#1
Thread Starter
New Member
all my IPs
Hello, today i got a problem writing code....
i need to determine all the IP addresses on a computer, on my case i have 2 NICs and a DUN connection to my ISP, i need to get the address of each conection DUN and 1 NIC get it address by DHCP the other one is fixed, but when i use a winsock and try to use .LocalIp it only returns the first NIC IP (the fixed one) and i need to receive requests from the two LANs connected by the NICs and some of them redirect to the DUN connection.... how can I get all those IPs?
thanx in advance to everyone...
-
Aug 26th, 2001, 11:52 PM
#2
Member
i was just at planetsourcecode.com trying to figure out almost the exact same thing, i found this clever code that loads winipcfg.exe, and copies the info. to the clipboard, then parses the info. for the IP number
run winipcfg.exe and press Ctrl + C and past the stuff in notepad, thats what your program can retrieve in code, all you got to do is parse it, it should contain all IPs, but i'm not sure, try it
if you want the source code, reply and ask and i'll give you a link to it or something, or you could go to the VB section at planetsourcecode.com and search for "winsock get IP", Vicki posted the source code i talked about
-
Aug 27th, 2001, 09:05 AM
#3
Thread Starter
New Member
Thanx for your reply
Ahriman : thanx for your suggestion, but i'm looking for an elegant way to do it... and i think is better to run "ipconfig" it displays the same info than winipcfg, and is easier to parse...
if someone know how to do it with an API call or something like that please post your way...
JJDriVeR
-
Aug 27th, 2001, 11:57 AM
#4
Member
I'd rather use an API call too, but i don't know any either. I've been looking for documentation on winsock.dll, winsock.ocx, and wininet.dll, and even microsoft.com doesn't have any. If i find out how i'll let ya know, like wise, if you figure it out i'd like to know too.
If anyone out there knows this magical API call, please reply.
-
Aug 27th, 2001, 02:29 PM
#5
Member
eureka, if found this page http://www.vbip.com/winsock-api/geth...ostname-01.asp
go there and download the source code, and run it. it should show all IP addresses on the local comp.
i don't know how the API calls work though, its complicated, i'm still trying to figure it out
Public Declare Function gethostbyname _
Lib "ws2_32.dll" (ByVal host_name As String) As Long
Public Declare Function gethostname _
Lib "ws2_32.dll" (ByVal host_name As String, _
ByVal namelen As Long) As Long
those are the API functions you need, i don't know why its in ws2_32.dll, i think the same functions are in winsock.dll
-
Aug 27th, 2001, 02:47 PM
#6
PowerPoster
WS2_32.dll are the latest versions of Winsock dll provided by Microsoft.
BTW, I seem to get a blank page on the link that you have posted. Infact I have trying for a long time, I am getting the same result for the whole "vbip.com" site( I have tried it on three different computers.
-
Aug 27th, 2001, 04:17 PM
#7
Member
IPHLPAPI.DLL
If you running NT 4.0 SP4 or W2K then you can use IPHLPAPI.DLL calls to get adapters info, IP addresses for all interfaces including WAN transports.
In case you running 9x/Me there is no easy way, except running IPconfig, or enumerating keys under Network\Net\MSTCP and get interfaces bound to TCP/IP stack then get the values from
System\CurrentControlSet\Services\Class\NetTrans\XXXX
Hope this helps.
-
Aug 27th, 2001, 05:04 PM
#8
Member
i was just getting some probs. with the site too, i guess they were having server probs. or someting, but it seems to be working now, i attached the source code i got from it incase anyone wants it and can't load the site
-
Aug 31st, 2001, 05:23 PM
#9
Thread Starter
New Member
here's a nice solution i found
to everybody who helps me... and for all the others interested in this post, i found the solution..... check this address they explain better than any effort i can do.... check it out boyz!
http://www.vbip.com/iphelper/get_tcp_table.asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|