Code example for InetAddress

Methods: equalsisLoopbackAddress

0
                    throw e;
                } 
            } 
            if (optID == SocketOptions.IP_MULTICAST_IF && (flags & MULTICAST_IF) != 0) {
                InetAddress inet = (InetAddress) val;
                if (NetUtil.bytesToInt(inet.getAddress(), 0) == 0 || inet.isLoopbackAddress()) {
                    ipaddress = ((InetAddress) val).getAddress();
                } else { 
                    InetAddress local = null;
                    try { 
                        local = InetAddress.getLocalHost();
                    } catch (UnknownHostException e) {
                        throw new SocketException("getLocalHost(): " + e.toString());
                    } 
                    if (inet.equals(local)) {
                        ipaddress = ((InetAddress) val).getAddress();
                    } else { 
                        throw new SocketException(val + " != getLocalHost(): " + local);
                    } 
                } 
            }