Closed bexp closed 7 years ago
I'll look into that right away.
Writing unit tests for Network Calculator. Seems to be ok though.
Unit tests work fine. Will create a pull request for the unit tests though.
class NetworkCalculatorTests: XCTestCase {
func testSubnetSize_classC() {
let ips = NetworkCalculator.getAllHosts(forIP: "192.168.0.1", andSubnet: "255.255.255.0")
XCTAssertEqual(ips?.count, 254)
}
func testSubnetSize_classB() {
let ips = NetworkCalculator.getAllHosts(forIP: "192.168.0.1", andSubnet: "255.255.252.0")
XCTAssertEqual(ips?.count, 1022)
}
func testSubnetSize_classA() {
let ips = NetworkCalculator.getAllHosts(forIP: "10.231.154.136", andSubnet: "255.254.0.0")
XCTAssertEqual(ips?.count, 131070)
}
}
@bexp you are using netmask 255.224.0.0, which is 10.231.154.136/11 which has 2097150 addresses. But you refer to ipcalc with netmask 255.254.0.0 which is 10.231.154.136/15 which has 131070 addresses. So both ipcalc and your code are correct, but using different netmasks.
any idea why the app hangs ? it's handing in your swift example too
I guess 2millions * 2 (ping and mac retrieve) operations are too much to handle. When I was building the framework I was thinking about /24,/23,/22 minimum. I think I will setup some similar network and I will try to optimize it.
I'm on xfinity wifi network (very popular if not the largest internet provided in US) they have hotspots everywhere
Hi MMLanScan fails to work in Class A network.
my IP/Subnet = 10.231.154.136/255.254.0.0
ipcalc shows 131070 possible hosts in given subnet
where is NetworkCalculator.getAllHostsForIP calculates this amount to be ~2 million
As a result array of IP's allocates ~100Mb of memory and MMLANScanner.start hangs