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 .. ?
Printable View
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 .. ?
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
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...Then use an Inet Control to get that page source and split it!PHP Code:<?php print('IP:<b> '. $_SERVER['REMOTE_ADDR'] .'</b>') ?>
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
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 IPQuote:
Originally Posted by penagate
bingo.... I have got it... Thanks everybody for your help...
My i ask what your final code turned out like?