Solved

j2me ip show

Posted on 2006-07-18
3
220 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
3 Comments
 
LVL 15

Accepted Solution

by:
bpmurray earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now