View Ipv4 address

If you have completed an application and wish to share the complete source/project files with everyone then please post it in here. Source-code files only, no tutorials.
4 posts Page 1 of 1
Contributors
User avatar
Nocturnalcodes
Dedicated Member
Dedicated Member
Posts: 51
Joined: Tue Aug 16, 2011 12:08 am

View Ipv4 address
Nocturnalcodes
This is how to view your IPV4 Address. For those who don't know what that is or what that's used for, its your kinda other IP address that is the real thing that you don't want hackers or viruses to get a hold of because that way they can send you stuff or receive stuff (Spyware) and its used for tcp or any data sending or receiving. So I have been searching online for a while on how to get this so when you make a chat or IM you won't have to require the user for there IP or the other persons IP and i could not find one so i just wanted to make a quick tutorial on it :D

So first we add a function
Code: Select all
    Function ReturnLocalIP(ByVal Type As Net.Sockets.AddressFamily) As String
        'The Main function that will get the IPV4 for you
        Dim HostEntry As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
        For Each IP As Net.IPAddress In HostEntry.AddressList
            If IP.AddressFamily = Type Then
                Return IP.ToString
            End If
        Next
        Return "NULL"
    End Function
Next we are actually going to put the function in Play
Code: Select all
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'This is where you decrare where you want it to display the IP
        TextBox1.Text = ReturnLocalIP(Net.Sockets.AddressFamily.InterNetwork)
    End Sub
I put Mines in my Form load but you can put it any where and in anything you can also edit the code to fit your needs

-Nocturnal
- Nocturnal
User avatar
Bogoh67
VIP - Site Partner
VIP - Site Partner
Posts: 656
Joined: Sun Apr 18, 2010 8:20 pm

Re: View Ipv4 address
Bogoh67
tisk tisk tisk http://community.xat.com/showthread.php ... sual-Basic
looks awfullly similiar
dude almost everything you put here is near virus related are you trying to get us banned for life
User avatar
Nocturnalcodes
Dedicated Member
Dedicated Member
Posts: 51
Joined: Tue Aug 16, 2011 12:08 am

Re: View Ipv4 address
Nocturnalcodes
Bogoh67 wrote:
tisk tisk tisk http://community.xat.com/showthread.php ... sual-Basic
looks awfullly similiar
dude almost everything you put here is near virus related are you trying to get us banned for life
what do you mean virus and banned for life this is for tcp chatting only
- Nocturnal
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: View Ipv4 address
M1z23R
That is your local ip, if you are using dsl connection it will return in 90% cases 192.168.x.x
This is how to get real ip :


Code: Select all
Imports System.IO
Imports System.Net
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim MyRequest As WebRequest = WebRequest.Create("http://whatismyip.org")
        Dim MyResponse As WebResponse = CType(MyRequest.GetResponse, HttpWebResponse)
        Dim MyReader As New StreamReader(MyResponse.GetResponseStream())
        Dim MyContent As String = MyReader.ReadToEnd()
        MyReader.Close()
        MsgBox("Your ip address is : " + MyContent)
    End Sub
4 posts Page 1 of 1
Return to “Source-Code”