BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-28-2009, 05:41 AM   #1 (permalink)
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 05:48 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Dec 2007
Location: East Texas
Model: 8230
OS: 4.6.1.208
Carrier: Alltel
Posts: 110
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

uhm, wat?
Offline  
Old 05-28-2009, 05:53 AM   #3 (permalink)
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 06:14 AM   #4 (permalink)
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 06:34 AM   #5 (permalink)
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: vodafone
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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