218 public Object nextElement () {
219 if (!hasMoreElements()) {
220 throw new NoSuchElementException ("no more addresses");
221 }
222 Object next = nextAddr;
223 nextAddr = null;
224 return next;
225 }
226
227 private InetAddress getNext() {
228 while (true) {
229 if (currIf == null) {
230 currIf = getNextIf();
231 if (currIf == null) {
232 return null;
233 }
234 addrs = currIf.getInetAddresses();
235 }
236 while (addrs.hasMoreElements()) {
237 InetAddress addr = (InetAddress) addrs.nextElement();
238 if (filter.isInstance (addr) && !addr.isLoopbackAddress()) {
239 if (Arrays.equals (addr.getAddress(), fe80_loopback)) {
240 continue;
241 }
242 return addr;
243 }
244 }
245 currIf = null;
246 }
247 }
248
249 private NetworkInterface getNextIf () {
250 while (ifs.hasMoreElements()) {
251 NetworkInterface nic = (NetworkInterface)ifs.nextElement();
252 try {
253 if (nic.isUp() && !nic.isLoopback())
254 return nic;
255 } catch (SocketException e) {
256 // ignore
257 }
258 }
|
218 public Object nextElement () {
219 if (!hasMoreElements()) {
220 throw new NoSuchElementException ("no more addresses");
221 }
222 Object next = nextAddr;
223 nextAddr = null;
224 return next;
225 }
226
227 private InetAddress getNext() {
228 while (true) {
229 if (currIf == null) {
230 currIf = getNextIf();
231 if (currIf == null) {
232 return null;
233 }
234 addrs = currIf.getInetAddresses();
235 }
236 while (addrs.hasMoreElements()) {
237 InetAddress addr = (InetAddress) addrs.nextElement();
238 if (filter.isInstance (addr) && !addr.isLoopbackAddress() && !addr.isLinkLocalAddress()) {
239 if (Arrays.equals (addr.getAddress(), fe80_loopback)) {
240 continue;
241 }
242 return addr;
243 }
244 }
245 currIf = null;
246 }
247 }
248
249 private NetworkInterface getNextIf () {
250 while (ifs.hasMoreElements()) {
251 NetworkInterface nic = (NetworkInterface)ifs.nextElement();
252 try {
253 if (nic.isUp() && !nic.isLoopback())
254 return nic;
255 } catch (SocketException e) {
256 // ignore
257 }
258 }
|