0

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??

Rich
  • 4,157
  • 5
  • 33
  • 45
  • There are ultimately more than three possibilities for a netmask, though its true that ones which are assigned by whole octet are most common. – Chris Stratton Apr 10 '14 at 21:44

1 Answers1

0

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.

gipinani
  • 14,038
  • 12
  • 56
  • 85