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


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

LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception )

From saggar <sunil.saggar@gmail.com>
Newsgroups comp.lang.java.programmer
Subject LinkLocal Address ( InetAddress.getByName throws UnknownHost Exception )
Date 2011-06-14 23:15 -0700
Organization http://groups.google.com
Message-ID <342cbab4-13c5-464c-8b02-18c23de35a39@y30g2000yqb.googlegroups.com> (permalink)

Show all headers | View raw


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 ?

-Sunil

Back to comp.lang.java.programmer | Previous | NextNext 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