comparison src/wifibroadcast/WifiBroadcast.java @ 12:e1f43b669cdb

broadcast on DatagramChannel
author one
date Sun, 29 Jul 2012 14:37:12 +0900
parents fc180f38257e
children bb2538b7eb8d
comparison
equal deleted inserted replaced
11:7912fd3af027 12:e1f43b669cdb
59 59
60 public InetAddress getBroadcast0() throws UnknownHostException { 60 public InetAddress getBroadcast0() throws UnknownHostException {
61 return InetAddress.getByName("192.168.100.66"); 61 return InetAddress.getByName("192.168.100.66");
62 } 62 }
63 63
64 public InetAddress getBroadcast() throws SocketException { 64 public static InetAddress getBroadcast() throws SocketException {
65 Enumeration<NetworkInterface> interfaces = 65 Enumeration<NetworkInterface> interfaces =
66 NetworkInterface.getNetworkInterfaces(); 66 NetworkInterface.getNetworkInterfaces();
67 while (interfaces.hasMoreElements()) { 67 while (interfaces.hasMoreElements()) {
68 NetworkInterface networkInterface = interfaces.nextElement(); 68 NetworkInterface networkInterface = interfaces.nextElement();
69 if (networkInterface.isLoopback()) 69 if (networkInterface.isLoopback())