BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-28-2009, 04:41 AM   #1
Suvarna
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Default IPAddress and broadcasting

Please Login to Remove!

Hello,

i am developing an application. in that i need to braodcast in LAN and want to have array of ip addresses in lan ..
how can i do this ..
for this i need to activate wifi on my device
am very new to this..

thoughts and suggestion are welcome

Thanks in advacne
Offline  
Old 05-28-2009, 04:48 AM   #2
google123
Thumbs Must Hurt
 
Join Date: Dec 2007
Location: East Texas
Model: 8230
OS: 4.6.1.208
Carrier: Alltel
Posts: 110
Default

uhm, wat?
Offline  
Old 05-28-2009, 04:53 AM   #3
Suvarna
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Default

ok
i have a code which is written in .net, i need to convert

string sIP = "";
IPHostEntry IPHost = Dns.Resolve(Dns.GetHostName());
IPAddress[] addressList = IPHost.AddressList;
if(IPHost.AddressList.Length >0)
sIP = addressList[IPHost.AddressList.Length - 1].ToString();
else
sIP = "Unable to determine network address Error";

this means, i have IP address on my own, with the use of it i am broadcasting in LAN.

i need to implment this way on BlackBerry
Offline  
Old 05-28-2009, 05:14 AM   #4
Suvarna
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Default

in the above code
Dns.GetHostName) returns my machines name "machine2"
one of the field (AddressList) in IPHost will contain my IP address

so in case of BlackBerry i need to know IP address f my device and using that ip address i will broadcast ??

but i am not getting IPADdress?

how can i resolve this ?
Offline  
Old 05-29-2009, 05:34 AM   #5
Suvarna
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Default

this is how i got IP address

int apnId = RadioInfo.getAccessPointNumber("rim.net.gprs");
byte[] ipaddr = RadioInfo.getIPAddress(apnId);
String ip =new String("");
for(int i = 0;i<ipaddr.length;i++){
System.out.print(" "+(ipaddr[i] & 0xff));
int temp = (ipaddr[i] & 0xff);
if(i<3)
ip=ip.concat(""+temp+".");
else{
ip=ip.concat(""+temp);
System.out.println("ipaddress "+ip);
}
}

but in this i have hardcoded the APN string ,, is there anyway by which i can get to know whats the APN on device .. as am testing this on simulator
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


441 SLQ 1K Duncan Slideline Potentiometer - 1 K. picture

441 SLQ 1K Duncan Slideline Potentiometer - 1 K.

$6.95



10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT picture

10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT

$51.49



US Stock 10 Units 100K B100K OHM Linear Taper Rotary Potentiometer POT Red Knob picture

US Stock 10 Units 100K B100K OHM Linear Taper Rotary Potentiometer POT Red Knob

$9.49



US Stock 10pcs 100K ohm Linear Taper Rotary Potentiometer Panel pot B100K 15mm picture

US Stock 10pcs 100K ohm Linear Taper Rotary Potentiometer Panel pot B100K 15mm

$12.05



US Stock 10K Potentiometer RV24YN 20S B103 24mm with knob and Digital Scale picture

US Stock 10K Potentiometer RV24YN 20S B103 24mm with knob and Digital Scale

$11.94



US Stock 10pcs 50K ohm Linear Taper Rotary Potentiometer Panel pot B50K 20mm picture

US Stock 10pcs 50K ohm Linear Taper Rotary Potentiometer Panel pot B50K 20mm

$12.21







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.