Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5343
| From | lewbloch <lewbloch@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception ) |
| Date | 2011-06-17 06:33 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <36e380b8-b32d-4a52-b5a3-c1170b121a1a@j13g2000pro.googlegroups.com> (permalink) |
| References | <342cbab4-13c5-464c-8b02-18c23de35a39@y30g2000yqb.googlegroups.com> <7ae996e5-64a1-460a-963b-7659dadd90e2@d26g2000prn.googlegroups.com> |
On Jun 17, 6:27 am, Lewis Bloch <lewisbl...@google.com> wrote:
> 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.
>
Oops. I should follow my own advice and check Javadocs first. Sorry.
It doesn't look specific to the JDK - the error says that the scope ID
was not found. The scope ID is "eth0", which implies that that
interface was not available on the target system at run time.
--
Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
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