equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
57 byte[] ifaddr = null; |
57 byte[] ifaddr = null; |
58 if (netif != null) { |
58 if (netif != null) { |
59 /* |
59 /* |
60 * Let's make sure we use an address of the proper family |
60 * Let's make sure we use an address of the proper family |
61 */ |
61 */ |
62 java.util.Enumeration it = netif.getInetAddresses(); |
62 java.util.Enumeration<InetAddress> it = netif.getInetAddresses(); |
63 InetAddress inetaddr = null; |
63 InetAddress inetaddr = null; |
64 while (!(inetaddr instanceof Inet4Address) && |
64 while (!(inetaddr instanceof Inet4Address) && |
65 it.hasMoreElements()) |
65 it.hasMoreElements()) |
66 inetaddr = (InetAddress) it.nextElement(); |
66 inetaddr = it.nextElement(); |
67 if (inetaddr instanceof Inet4Address) |
67 if (inetaddr instanceof Inet4Address) |
68 ifaddr = inetaddr.getAddress(); |
68 ifaddr = inetaddr.getAddress(); |
69 } |
69 } |
70 return isReachable0(addr.getAddress(), timeout, ifaddr, ttl); |
70 return isReachable0(addr.getAddress(), timeout, ifaddr, ttl); |
71 } |
71 } |