On 12/9/09 3:25 PM, Johnny Miller wrote:
The table has two columns an "IP_FROM" and an "IP_TO", each contains an IP
number.
According to the manual after you convert an IP address to an IP number it can
only resolve to one row in the database i.e.
IP_FROM<= X<= IP_TO
Not your original question, Chuck is -of course- right :-), but how do you
convert your IP address to an IP number?
This doesn't work for me for some addresses:
NSArray<String> tempArray = NSArray.componentsSeparatedByString(clientIPAddress,
":");
clientIPAddress = new String(tempArray.objectAtIndex(0));
NSArray<String> ipOctets = NSArray.componentsSeparatedByString(clientIPAddress,
".");
int ipOctet1 = Integer.parseInt(ipOctets.objectAtIndex(0));
int ipOctet2 = Integer.parseInt(ipOctets.objectAtIndex(1));
int ipOctet3 = Integer.parseInt(ipOctets.objectAtIndex(2));
int ipOctet4 = Integer.parseInt(ipOctets.objectAtIndex(3));
int intIPAddress = (ipOctet1 * 16777216) + (ipOctet2 * 65536) + (ipOctet3 *
256) + ipOctet4;
I'm guessing it has something to do with int not being large enough or the
column type in the database.
--
Klaus Berkling
Systems Administrator
DynEd International, Inc.
www.dyned.com | www.eskimo.com/~kiberkli <www.eskimo.com/%7Ekiberkli>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]