Quote:
Originally Posted by austin1743
ok cool,
i have the cRio at 10.17.43.2
and the computer at 10.17.43.5 (i believe)
what is the correct range?
|
By range, he means the same IP subnet.
How IP subnets work is if you look at the IP address and subnet mask in binary, the 1s in the subnet mask mean that that bit of the address is part of the the network address, and 0s in the subnet mask mean that that bit of the address is part of the the node address. So, they are in the same subnet if all of the network bits in the IP address are the same.
So,
Code:
// pseudo-code
// Addresses in binary
cRIO = 10.17.43.2 ; // 00001010.00010001.00101011.00000010
laptop = 10.17.42.5 ; // 00001010.00010001.00101011.00000101
netmask= 255.255.255.0; // 11111111.11111111.11111111.00000000
// binary and
cRIO_network = cRIO & netmask
laptop_network = laptop & netmask;
println(" > "+cRIO_network); println(" > "+laptop_netowork);
> 00001010.00010001.00101011.00000000
> 00001010.00010001.00101011.00000000
println(" > "+(cRIO_network == laptop_network))
> true
Without doing any binary math, though, if the subnet mask is all 255s and 0s, you can tell easily; 255 means that octet is network, and 0 means node. A mask of "255.255.255.0" means that your range is "10.17.42.*".