Brilliant Answers guys, I was going in that direction

Thank you to all for your insight, will let you know how it turns out.

WP

Quote Originally Posted by flyguille View Post
VB is very fast you can check against an array dozen of thousands of times per second.

Just take your time to measure.... it is simple numericals.

oh, and another thing.

you really don't needs to convert it to decimals, normally the Internet is build up in pre-assigned ranges to ISPs and are all BASED on the first and second number.

Don't use decimals.

uses ranges this way (first*256)+second, so it still Integer value.

so

private const Total = 1000
private LastInUse as integer
private Base(0 to Total-1) as long
private Top(0 to Total-1) as long

then

_ConnectionRequest
dim x as integer, y as integer
dim STRD as string
dim num as long

strd=.remoteIP

x=instr(strd,".")
y=instr(x+1,strd,".")
num=val(mid$(strd,1,x-1)) * 256 + val(mid$(strd,x+1,y-(x+1)))

if LastInUse>=0 then
for x=0 to LastInUse

if num>= base(x) and num <top(x) then ' Ok, is in USA.

next x
endif




EDIT: But if you want it FASTER, I recommend you to use LOOK UP TABLES.

IT is easy.



private IsInUSA(0 to 255, 0 to 255) as boolean


Configure the table one time.... TRUE if in USA, FALSE if not.


then...

_ConnectionRequest
dim x as integer, y as integer
dim STRD as string


strd=.remoteIP

x=instr(strd,".")
y=instr(x+1,strd,".")

if IsInUSA(val(mid$(strd,1,x-1)), val(mid$(strd,x+1,y-(x+1)))) then ' Is in USA.