| | |
| | | import android.net.wifi.WifiInfo; |
| | | import android.net.wifi.WifiManager; |
| | | |
| | | import com.hdl.sdk.hdl_core.Util.LogUtil.HDLLog; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.InterfaceAddress; |
| | | import java.net.NetworkInterface; |
| | |
| | | //只有 IPv4 网络具有广播地址,因此对于 IPv6 网络将返回 null。 |
| | | if (interfaceAddress.getBroadcast() != null) { |
| | | broadCastIp = interfaceAddress.getBroadcast().getHostAddress(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | if(broadCastIp == null){ |
| | | HDLLog.E("getLocalBroadCast error ip null"); |
| | | } |
| | | return broadCastIp; |
| | | } |