Results 1 to 8 of 8

Thread: Display the IP of the system

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    76

    Display the IP of the system

    I want to Display the IP of the system in which a program of mine is running. How do I do this using VB ... please somebody help .. ?

  2. #2
    New Member
    Join Date
    Mar 2006
    Posts
    14

    Re: Display the IP of the system

    You can do this by using winsock. First add winsock to your project: ctrl+t and select winsock control 6.0. Put winsock in your form and add this code:
    Private Sub Command1_Click()
    MsgBox Winsock1.LocalIP
    End Sub

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Location
    Newcastle, UK
    Posts
    19

    Re: Display the IP of the system

    Yeah but the user could be behind a router in which case it would just display 192.168.1.3 or alike. What you could do is create a PHP file with this in it...
    PHP Code:
    <?php print('IP:<b> '$_SERVER['REMOTE_ADDR'] .'</b>'?>
    Then use an Inet Control to get that page source and split it!

  4. #4
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Display the IP of the system

    you could do that as Winsocket said but, if you run your app on different network machines then the IP will be identical everytime, this is because the IP which you get from Winsockets example is not the true IP of the computer, its the internet IP address of the router access point
    Chris

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Display the IP of the system

    Which is actually the true IP of the computer It simply may be shared across multiple computers within the network via NAT. For all intents and purposes you don't need to know that.

  6. #6
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Display the IP of the system

    Quote Originally Posted by penagate
    Which is actually the true IP of the computer It simply may be shared across multiple computers within the network via NAT. For all intents and purposes you don't need to know that.
    technically its not the true IP, as the true IP will be the network computer, an IP is used to identify an individual, you cant connect to a network terminal via your router internet IP, only the true terminal IP
    Chris

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    76

    Re: Display the IP of the system

    bingo.... I have got it... Thanks everybody for your help...

  8. #8
    Junior Member
    Join Date
    Mar 2006
    Location
    Newcastle, UK
    Posts
    19

    Re: Display the IP of the system

    My i ask what your final code turned out like?

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