Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
Aviator168
Posts: 694
Registered: 09-10-2009
My Carrier: Verizon

Getting the IP address of remote server by name without making a connection.

Is this possible?

 

I really hate to create some kind of socket connection or datagram connection just for obtaining the IP address of a remote host. Is there a short cut to do this like most OS APIs gethostbyname call?

Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: 09-30-2009

Re: Getting the IP address of remote server by name without making a connection.

gethostbyname makes a connection. This is how DNS works everywhere.

 

Why do you need the IP address?

 

If you're connecting through BES/BIS, and you don't need to rely on DNS, because the BES/BIS servers will do this for you.

Please use plain text.
Developer
Aviator168
Posts: 694
Registered: 09-10-2009
My Carrier: Verizon

Re: Getting the IP address of remote server by name without making a connection.

I need to unicast the same message to multiple receivers.

 

dc = (UDPDatagramconnection) Connector.open("udp://;1234;interface=wifi");

 

Datagram dg = dc.newDatagram(buf, buf.length);

 

dg.setAddress(IPAddrOfServer1);

dc.send(dg);

 

dg.setAddress(IPAddrOfServer2);

dc.send(dg);

 

dg.setAddress(IPAddrOfServerN);

dc.send(dg);

 

 

 

 

Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: 09-30-2009

Re: Getting the IP address of remote server by name without making a connection.

I don't think there is any support for DNS in the BB API (there might be in 5.0? I didn't look); you will have to implement a DNS resolver yourself, I think.

Please use plain text.