java - Why does isSiteLocalAddress() behave differently on the same model device running the same Android version? -


i have 2 samsung galaxy siis on same network running same version of android (4.0.4). when method called ...

private string getipaddress() {     string ip = "something's wrong, of course!";     try {         enumeration<networkinterface> networkinterfaces =                  networkinterface.getnetworkinterfaces();         while ( networkinterfaces.hasmoreelements()) {             networkinterface ni = networkinterfaces.nextelement();             enumeration<inetaddress>inetaddresses =                     ni.getinetaddresses();             while (inetaddresses.hasmoreelements()) {                 inetaddress address = inetaddresses.nextelement();                  if (address.issitelocaladdress()) {                     ip = address.gethostaddress();                 }             }         }     } catch (socketexception se) {         se.printstacktrace();         ip = "some error occured; duck-dynasty!";     }     return ip; } 

on 1 device returns valid ip address. when call on same model device described above returns instantiated value; why?

i don't mean ask why method fail me on logical standpoint; obvious. mean, why 2 devices, described, return conflicting results? shouldn't one of network interfaces' address satisfy condition?

edit

well, started returning valid ip after days of not acting right. i'd provide answer no clue of why happening. still interested in why if knows.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -