我从 DHCP 信息中获取 IP 地址。当我有位表示的 IP 时如何计算下一个 IP 地址。
WifiManager wifii = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
DhcpInfo d = wifii.getDhcpInfo();
int mask = d.netmask;
int ip0 = d.ipAddress & d.netmask;
int num = ~d.netmask; //it should be correct but don't work. why?
//this don't work. How make it correct?
for(int ip = ip0; ip < ip + num; ip++){
//here ip next ip
}