Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #5342

Re: LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception )

From Lewis Bloch <lewisbloch@google.com>
Newsgroups comp.lang.java.programmer
Subject Re: LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception )
Date 2011-06-17 06:27 -0700
Organization http://groups.google.com
Message-ID <7ae996e5-64a1-460a-963b-7659dadd90e2@d26g2000prn.googlegroups.com> (permalink)
References <342cbab4-13c5-464c-8b02-18c23de35a39@y30g2000yqb.googlegroups.com>

Show all headers | View raw


On Jun 14, 11:15 pm, saggar <sunil.sag...@gmail.com> wrote:
> Hi,
>
> I used the following code to create a InetAddress from lilnklocal
> address ( returned by getifaddrs function).
>    try{
>         InetAddress add =
> InetAddress.getByName("fe80::216:3eff:fe38:74e8%eth0");
>      }
>      catch(UnknownHostException uhe){
>         System.out.println("Caught unknownhost exception ");
>         System.out.println("Message: "+uhe.getMessage());
>         uhe.printStackTrace();
>     }
>
> But it fails with the following message.
>
> java.net.UnknownHostException: no scope_id found
>         at java.net.Inet6Address.deriveNumericScope(Inet6Address.java:
> 358)
>         at java.net.Inet6Address.initif(Inet6Address.java:321)
>         at java.net.Inet6Address.initstr(Inet6Address.java:306)
>         at java.net.Inet6Address.<init>(Inet6Address.java:232)
>         at java.net.InetAddress.getAllByName(InetAddress.java:1062)
>         at java.net.InetAddress.getAllByName(InetAddress.java:1009)
>         at java.net.InetAddress.getByName(InetAddress.java:959)
>
> What could be the possible reasons for it ?  Is it specific to JDK
> version ?
>

The error message is quite clear - the DNS does not recognize the host
name.  What you passed to the call really doesn't look like a host
name, so that seems unsurprising.

--
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception ) saggar <sunil.saggar@gmail.com> - 2011-06-14 23:15 -0700
  Re: LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception ) Lewis Bloch <lewisbloch@google.com> - 2011-06-17 06:27 -0700
    Re: LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception ) lewbloch <lewbloch@gmail.com> - 2011-06-17 06:33 -0700

csiph-web