Results 1 to 1 of 1
Thread: Ip adresses comparison
- 05-30-2008, 12:13 AM #1
Member
- Join Date
- May 2008
- Posts
- 1
- Rep Power
- 0
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
ModestLast edited by ModestUrgell; 05-30-2008 at 12:21 AM.
Similar Threads
-
Object Comparison!
By sajdutt in forum Advanced JavaReplies: 6Last Post: 05-23-2008, 01:48 PM -
String comparison
By abhiN in forum New To JavaReplies: 2Last Post: 04-09-2008, 04:47 AM -
Comparison of Strings
By Cero.Uno in forum New To JavaReplies: 3Last Post: 02-11-2008, 02:46 AM -
Date comparison
By Rageagainst20 in forum New To JavaReplies: 0Last Post: 12-19-2007, 06:34 PM -
String comparison
By sireesha in forum New To JavaReplies: 1Last Post: 12-18-2007, 12:16 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks