Comparing IP addresses
843790Aug 7 2009 — edited Aug 21 2009Hi everyone!
I have an IP address which belongs to the type InetAddress and I would like to check if it is within the range: 192.168.1.2 -> 192.168.1.101. I was thinking about using methods like greater than and smaller than but I can't find any for this class. Moreover, how I should define 192.168.1.2 and the other one? As String and then convert to another type? And the last thing: the IP address I have to compared is got using the method getInetAddresses(), which means that an annoying slash "/" is the first character of the address: (e.g. if I print it: /192.168.1.22) which probabaly makes it more difficult to be compared.
Can you help me please??
Many thanks in advance