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


New MSA Altair Pro O2 Gas Detector (Part Number 10074137c) - Open Box picture

New MSA Altair Pro O2 Gas Detector (Part Number 10074137c) - Open Box

$269.99



MSA Sensor Kit ALTAIR Pro ALTAIR 5X 10080222 picture

MSA Sensor Kit ALTAIR Pro ALTAIR 5X 10080222

$210.00



MSA ALTAIR 4XR 10178557 Detector Multi Gas Meter (LEL, O2, CO, H2S) picture

MSA ALTAIR 4XR 10178557 Detector Multi Gas Meter (LEL, O2, CO, H2S)

$790.00



Commercial Convection Steamer Altair picture

Commercial Convection Steamer Altair

$800.00



🔅MSA altair 4X multi gas Meter Monitor detector, (O2,H2S,CO,LEL) & Charger picture

🔅MSA altair 4X multi gas Meter Monitor detector, (O2,H2S,CO,LEL) & Charger

$299.00



msa altair gas detector Lot Of 6 picture

msa altair gas detector Lot Of 6

$130.00







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