Here you can find the source of isValidIpAddress(InetAddress ip)
Parameter | Description |
---|---|
ip | a parameter |
private static boolean isValidIpAddress(InetAddress ip)
//package com.java2s; /******************************************************************************* * Copyright (c) 2006, 2007 Bug Labs, Inc.. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.buglabs.net/legal/epl_license.html *******************************************************************************/ import java.net.Inet6Address; import java.net.InetAddress; public class Main { /**/*ww w.ja v a 2 s . c o m*/ * Determine if IP address is valid for BUG to use for event notification. * * @param ip * @return */ private static boolean isValidIpAddress(InetAddress ip) { if (ip instanceof Inet6Address) { return false; } // loopback if (ip.getAddress()[0] == 127) { return false; } return true; } }