Hi,
The code is below: I tried google too
/**
* Returns IP address given hostname, handles exceptions
*/
public void getIPAddr () {
try {
java.net.InetAddress inetAddr1[] =
java.net.InetAddress.getAllByName("
google.com") ;
Log.d(TAG, "TAG - Inet address
google.com - getAllByName" +
inetAddr1[0] );
} catch (java.net.UnknownHostException e1) {
Log.d(TAG, "TAG - Inet address error
google.com -
getAllByName" );
}
try {
java.net.InetAddress inetAddr2 =
java.net.InetAddress.getByName("
google.com") ;
Log.d(TAG, "TAG - Inet address
google.com - getByName" +
inetAddr2 );
} catch (java.net.UnknownHostException e1) {
Log.d(TAG, "TAG - Inet address error
google.com -
getByName" );
}
finally {
Log.d(TAG, "TAG - OUT OF getIPAddr" );
}
}
***********************************
Here only the catch block is getting executed. Trace excerpt
D/SC( 1123): TAG - Addr error
google.com - getAllByName
D/SC( 1123): TAG - Addr error
google.com - getByName
D/SC( 1123): TAG - OUT OF getIPAddr
**********************************
Regards,
Aad
On Dec 2, 1:57 am, Nirjon <
nir...@gmail.com> wrote:
> Hi,
>
> How did you call the InetAddress.getByName() method? Could you paste that
> part of your source code?
>
> btw. I tried to go
towww.starwave.com(with my laptop's browser) and it
> seems like the website does not exist. And when I use (199.181.132.250) in
> my browser it goes to
go.com.
>
> Shahriar Nirjon
> University of Virginia.
>
>
>
>
>
> On Tue, Nov 30, 2010 at 7:52 PM, aad <
gsa....@gmail.com> wrote:
> > Hi,
> > I need to resolve an host address to ip.
> > My android device can ping to the hostname only to resolve the host
> > to
> > IP . But when I use InetAddress.getByname, it throws an exception.
>
> > An excerpt of hyper terminal trace is below.
>
> > Please help me resolve this issue by letteing me know which api i
> > must
> > use as ping is only having DNS resolution but not successful packet
> > transmission.
>
> > Trace:
>
> > # ping -c
2www.google.com
> >
PINGwww.l.google.com(209.85.132.104) 56(84) bytes of data.
> > ^C
> > ^C
>
> > ---www.l.google.comping statistics ---
> >
http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > Regards,
> > GSA
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-platform" group.
> > To post to this group, send email to
android-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
android-platfo...@googlegroups.com<android-platform%2Bunsubscrib
e...@googlegroups.com>
> > .
> Nirjon.- Hide quoted text -
>
> - Show quoted text -