Results 1 to 1 of 1
Thread: Ip adresses comparison
- 05-30-2008, 12:13 AM #1Member
- Join Date
- May 2008
- Rep Power
Ip adresses comparison
I am a beginner.
In a servlet, I need to know if the cllient address is between two adresses.
What is the best way to do that ?
I have done
InetAddress addr = InetAddress.getByName("hostname1");
byte adress_max = addr.getAddress();
addr = InetAddress.getByName("hostname2");
byte adress_min = addr.getAddress();
final InetAddress address = InetAddress.getByName(request.getRemoteHost());
final byte bytes = address.getAddress( );
and then I compare the bytes.
It works but I was wondering if there is some other way
Last edited by ModestUrgell; 05-30-2008 at 12:21 AM.
- By sajdutt in forum Advanced JavaReplies: 6Last Post: 05-23-2008, 01:48 PM
- By abhiN in forum New To JavaReplies: 2Last Post: 04-09-2008, 04:47 AM
- By Cero.Uno in forum New To JavaReplies: 3Last Post: 02-11-2008, 03:46 AM
- By Rageagainst20 in forum New To JavaReplies: 0Last Post: 12-19-2007, 07:34 PM
- By sireesha in forum New To JavaReplies: 1Last Post: 12-18-2007, 01:16 AM