06-24-2010 08:51 AM
does datagram connection support DNS resolver? I am trying to send a single datagram in the following way:
UDPDatagramConnection connection = connection = (UDPDatagramConnection) Connector.open("datagram://;interface=wifi");
Datagram datagram = datagram = new DatagramBase();
It always results with "java.io.IOException: General socket error" when sending.
However, if I insert corresponding IP address instead of the domain in the setAddress method it works very well.
If I cannot pass a domain name as a parameter in this function, is there a way to obtain the IP address of that domain programatically?
06-24-2010 02:40 PM
You need to specify an IP address when making a UDP connection.
The BlackBerry API set does not have any classes to look up an IP address directly. However, you could make a socket or HTTP connection to your server using its DNS name and have it return its IP address.
06-24-2010 04:03 PM
setAddress only takes IP address. It does not take domain name.
If you want to translate domain name to IP address, you can use jdnp (http://delta.affinix.com/jdns/). Giving a DNS server name, you can translate any domain name to its IP address.
09-07-2011 01:45 AM
Thanks for the reply. Yes we can create any socket or HTTP connection using DNS name. Then that connection objects are keeping the IP addresses as protected variables.
As you told it returns its address, No its not returning its IP addressed.
Can you please suggest any way to get the IP address.