Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Finding phone's IP?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-13-2008, 09:07 AM
Newbie
 
Join Date: May 2008
Posts: 3
Default Finding phone's IP?

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!

PS
The 3 character search limit is a bummer Can't search words like IP.
Reply With Quote
  #2 (permalink)  
Old 05-13-2008, 09:32 AM
Newbie
 
Join Date: May 2008
Posts: 3
Default

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

Code:
Sub Globals
    
Dim sIP(0As String
End Sub

Sub App_Start
    Form1.Show
    Server.New1(
50000)
    Client.New1
    sName = Server.HostName
    
sIP() = Client.GetIp(sName)
    
    
For i = 0 To ArrayLen (IP()) - 1
                 sIP2 = IP(i)
    
Next

    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 by XHorntail : 05-13-2008 at 10:10 AM.
Reply With Quote
  #3 (permalink)  
Old 05-13-2008, 09:36 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

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

Sub App_Start
    server.New1(
0)
    client.New1
    ip() = client.GetIP(server.HostName)
    
For i = 0 To ArrayLen(ip())-1
        
Msgbox(ip(0))
    
Next
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.
Reply With Quote
  #4 (permalink)  
Old 05-13-2008, 10:34 PM
Newbie
 
Join Date: May 2008
Posts: 3
Default

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!
Reply With Quote
  #5 (permalink)  
Old 05-14-2008, 03:58 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Quote:
Your solution is pretty close to mine!
It's basically the same. I only saw your second post after submitting my example.

Quote:
I have to say, this is one of the best non-microsoft IDE I've used, especially at it's price bracket!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding those important forum posts enonod Code Samples & Tips 0 05-30-2008 08:02 AM
Finding the parent of a control willisgt Questions (Windows Mobile) 3 02-15-2008 06:53 PM
Finding DLL on PPC paul j Questions (Windows Mobile) 11 09-30-2007 02:35 PM


All times are GMT. The time now is 09:30 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0