문제

In Android (or Java, I suppose), it's easy enough to determine whether a given address is site-local:

InetAddress a = InetAddress.getByName (addr_string);
if (a.isSiteLocalAddress())
    ...

However, each of the three flavors of site-local addresses has a different netmask associated with it. Is there a quick and easy to generate the netmask from the address??

도움이 되었습니까?

해결책

The netmask is used to establish which part of an addres is the network address, which part is dedicated to the hosts and which one is broadcast.

You make a bit-by-bit and between ip address and subnet mask in order to individuate each part.

You need more information than ip address in order to get netmask.

Hope this helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top