This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes getting the ipaddress Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "getting the ipaddress" Watch "getting the ipaddress" New topic
Author

getting the ipaddress

Benjoe Reyes
Ranch Hand

Joined: Apr 24, 2002
Posts: 109
how could we get the ip address of a nokia phone particularly N3530, N3650 and N6610?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Just out of curiosity? Wouldn't a Cell Phone's IP address change every time, like get a new one each time for DHCP?
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Benjoe Reyes
Ranch Hand

Joined: Apr 24, 2002
Posts: 109
but how do we programatically get the ip address assigned by the DHCP server even for that particular moment???
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I was just curious, I remember reading it somewhere, and how you can post the IP address to a website, so that others can get that information, but I can't remember more than that. It is in the specifications for either the Messaging API, or ...

Nope, Push technology.

To create an inbound connection based on a static address, call Connector.open() with a URL that describes both a protocol and a local inbound port; for example:
Connector.open("socket://:5000")
Connector.open("datagram://:5000")
Connector.open("sms://:5000")


To create an inbound connection based on a dynamic address, call Connector.open() with a URL that describes just a protocol (and not a local inbound port), to indicate you want the system to assign an address; for example:
Connector.open("socket://")
Connector.open("datagram://")


When using a system-assigned address, you must publish this address so that external systems can connect to your application. If you're using a ServerSocketConnection or a UDPDatagramConnection you can get the dynamically assigned address from the getLocalAddress() and getLocalPort() methods. You can also retrieve the hostname assigned to your device, by invoking System.getProperty("microedition.hostname"). To publish the dynamic address on an external system you can simply use HTTP.

Found here.

Hope that helps.
Mark
David Price
Ranch Hand

Joined: Jan 22, 2003
Posts: 93
With many (most?) operators, it's no use to get the phone's IP address. These operators' firewalls prevent inbound TCP connection attempts, and inbound UDP packets that don't match a recent outbound UDP packet. I have SIM cards from the two main operators in my area, and they both have this kind of firewall (though I'm told that the third operator doesn't have this restriction yet).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getting the ipaddress
 
Similar Threads
Tech Word Game
what I can do with the logo ?
Most Stupid thing your ever did
life is boring
[GROSS] Necrophilia