Results 1 to 9 of 9

Thread: all my IPs

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Guadalajara, Jalisco Mexico
    Posts
    9

    Question 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...

  2. #2
    Member
    Join Date
    Apr 2001
    Location
    Hamilton, ON, Canada
    Posts
    43
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Guadalajara, Jalisco Mexico
    Posts
    9

    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

  4. #4
    Member
    Join Date
    Apr 2001
    Location
    Hamilton, ON, Canada
    Posts
    43
    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.

  5. #5
    Member
    Join Date
    Apr 2001
    Location
    Hamilton, ON, Canada
    Posts
    43
    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

  6. #6
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    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.

  7. #7
    Member
    Join Date
    Sep 2000
    Posts
    39

    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.

  8. #8
    Member
    Join Date
    Apr 2001
    Location
    Hamilton, ON, Canada
    Posts
    43
    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

  9. #9

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Guadalajara, Jalisco Mexico
    Posts
    9

    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
  •  



Click Here to Expand Forum to Full Width