Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 69
Registered: ‎08-13-2008
My Device: Not Specified

How to get my hostname and local ip address

Hi, i am trying to get my hostname in jde4.2 and the ip address that my BB has any idea how to get this data?

thanks

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to get my hostname and local ip address

Not really my area, but here is a quick answer.  Hopefully someone else will provide a fuller answer later.

 

Unless you are connecting wirelessly, which I don't think is supported in OS 4.2, you do not have a network IP Address or Host Name.  All your IP Traffic is tunneled to you via what is effectively a NAT box or proxy service - either provided by carrier for direct TCP, or via the MDS for BES/MDS connection.

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: How to get my hostname and local ip address

You can always have a server report it back to you but more directly

SocketConnection.getLocalAddress() is supposed to work but I've never tried it.

It further claims,  

"The local hostname (if available) can be accessed from System.getProperty("microedition.hostname")

 

If you initiate a connection, the peer can reply to whatever IP is advertised but

it would be nice to find a general means, even if carrier specific, of fixed originated

connection addressing. If you do find locally available interesting hostnames, please post some here and I'll try

to hit you from my desktop.

 

If you just want to talk to yourself, usually 127.0.0.1 will work.

I don't see anything in RIM class list that is obviously similar to InetAddress

http://www.google.com/search?hl=en&q=site%3Asun.com+local+ip+address&aq=f&oq=

 

 

Developer
Posts: 69
Registered: ‎08-13-2008
My Device: Not Specified

Re: How to get my hostname and local ip address

this System.getProperty("microedition.hostname") returns alwaus null while the getLocalAddress() give me an apipa address, i think that i have to search something different.
New Developer
Posts: 2
Registered: ‎11-07-2008
My Device: Not Specified

Re: How to get my hostname and local ip address

Hi jllarraz:

 

    i got the same issue; have you found out how to get them yet??

 

Thanks

Highlighted
Developer
Posts: 69
Registered: ‎08-13-2008
My Device: Not Specified

Re: How to get my hostname and local ip address

the only way taht i found to do this is create a udp connection and get the localaddress()