Finding phone's IP?

Discussion in 'Questions (Windows Mobile)' started by XHorntail, May 13, 2008.

  1. XHorntail

    XHorntail New Member

    I want to pull my IP into a variable. The Network library's GetIP looks like it only finds the IP of known sources, I just want my own external IP (localhost, but externally connectable.) The idea is to pull my IP, and send it in an SMS. Also, does the network library work for EVDO internet, or just WiFi? Could just test that, but figured I'd ask while I'm here.

    I look foward to working with everyone here!

    The 3 character search limit is a bummer :( Can't search words like IP.
  2. XHorntail

    XHorntail New Member

    Ok, solved it! Uses both server and client objects, code posted below for any future reference!

    Sub Globals
    Dim sIP(0As String
    End Sub

    Sub App_Start
       sName = 
    sIP() = Client.GetIp(sName)
    For i = 0 To ArrayLen (IP()) - 1
                     sIP2 = IP(i)

       Label1.Text = 
    "Computer IP: " & sIP2 'As per my results, the last value is the external IP
                                'If it results in an internal IP, your device is likely offline.

    End Sub
    Thid code hasn't been tested as typed, so please excuse any typo's.
    Last edited: May 13, 2008
  3. Erel

    Erel Administrator Staff Member Licensed User

    You should use something like:
    Sub Globals
    'Declare the global variables here.
        Dim ip(0)
    End Sub

    Sub App_Start
        ip() = client.GetIP(
    For i = 0 To ArrayLen(ip())-1
    End Sub
    The Network library should work with any reliable connection.

    I agree about the three characters search limit. If I remember correctly it is a limitation of the forum software.
  4. XHorntail

    XHorntail New Member

    Your solution is pretty close to mine! Thanks for the input! I didn't realise the Network Server Object could be instantiated with a Null port, good to know!

    I have to say, this is one of the best non-microsoft IDE I've used, especially at it's price bracket!
  5. Erel

    Erel Administrator Staff Member Licensed User

    It's basically the same. I only saw your second post after submitting my example.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice