Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

j2me ip show

Posted on 2006-07-18
3
Medium Priority
?
238 Views
Last Modified: 2008-02-01
i am using my mobile phone to connect to internet (gprs) from my laptop. i want to write a small java application for my mobile phone that shows my ip adress when it is executed. is this possible? if yes, any ideas for the code?
0
Comment
Question by:leventsatriani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
bpmurray earned 2000 total points
ID: 17130987
If you're using MIDP 1.0 you're out of luck, but 2.0 allows some access to that side of things. The reality is that you're probably behind your provider's Cone NAT, so you don't have much control over anything. Anyway, you should expect to have to manage a dynamically -assigned IP address. Anyway, there are two places where you might be able to find this based on the app that's running. Starting from the interfaces UDPDatagramConnection or ServerSocketConnection, there are the methods getLocalAddress and getLocalPort which should give you what you need.

Watch out, though: the IP address may be reassigned, so you can't depend on this address being permanent. I wonder when the providers will learn about IPv6!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Starting up a Project

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question