#39493 - 2003-04-24 02:23 PM
IsInIPRange Function
|
anthonyalderson
Getting the hang of it
Registered: 2003-03-20
Posts: 52
Loc: England
|
hi everyone, i'm new to kixtart and i'd like to ask a few questions if anyone would be so kind to answer, i've recently been creating a script to define default printers across a network of 18 remote centres, thing is i'm new to all this and the function i'd like to use i dont understand, the function is the isiniprange one, i dont understand how the dependencies work and what i need to do to create the script so that it'll check the local machines ip address against that defined in the array of said function, anyway thats quite a lot to read so i'll leave it with you guys if you dont mind, thanks for any help you might be able to give me guys,
Anth
|
Top
|
|
|
|
#39495 - 2003-04-24 03:02 PM
Re: IsInIPRange Function
|
Sealeopard
KiX Master
Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
|
That's a first, Jooel admitting that he doesn't get a UDF. Maybe we should convert it into the next KiXGolf challenge? Make IsInIPRange smaller and remove the dependencies?
Anyway, I think the UDF is straight-forward. However, I also wrote it
First of all, please read TCP/IP Primer, Part I - IP Addresses to refresh your TCP/IP network knowledge.
Secondly, you'll need to include IsInIPRange and it's two dependiencies in your script as e.g. described in How to use UDFs .
Finally, you feed the IP address and an array of networkIDs/subnets into the UDF and you will get a return statement indicating whether the IP address is part of the network. Please implement the example provided in the function header to see how it works.
_________________________
There are two types of vessels, submarines and targets.
|
Top
|
|
|
|
#39496 - 2003-04-25 11:10 AM
Re: IsInIPRange Function
|
anthonyalderson
Getting the hang of it
Registered: 2003-03-20
Posts: 52
Loc: England
|
thanks guys, you've given me a bit of insight into kix, and i feel a little more confident now, and now i'm just gonna have to play about with my script and include the necessary functions (of which i wasnt sure i had to do before), so many thanks guys and if i ever see you out sometime just tap me on the shoulder and i'll buy you a drink.
Anth
|
Top
|
|
|
|
#39498 - 2003-04-26 12:12 AM
Re: IsInIPRange Function
|
anthonyalderson
Getting the hang of it
Registered: 2003-03-20
Posts: 52
Loc: England
|
yeah will a double do?
|
Top
|
|
|
|
#39501 - 2003-04-25 03:08 PM
Re: IsInIPRange Function
|
anthonyalderson
Getting the hang of it
Registered: 2003-03-20
Posts: 52
Loc: England
|
okay guys i think i'm getting there, but could you have a look at this and tell me where i'm going wrong please, oh and dont worry about ice lads, i'll buy you a bottle of glenfiddich each for helping me out,
; DEFAULTPRINTER ; To retrieve local machines IP address and cross reference it against a set of defined subnets ; ; AUTHOR Anthony Alderson
CALL "binaryip.kix" CALL "ipmask.kix" CALL "isinsubnet.kix" CALL "isiniprange.kix"
$ipaddress='@IPADDRESS0' $iparray[0]='192.168. 12. 0/255.255.255. 0' ;ragworth
IF $ipaddress=$iparray[0] ? "you stink" sleep 3 ELSE ? "guess you dont stink after all" sleep 3 ENDIF
|
Top
|
|
|
|
#39506 - 2003-04-25 03:30 PM
Re: IsInIPRange Function
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
Top
|
|
|
|
#39508 - 2003-04-25 03:34 PM
Re: IsInIPRange Function
|
anthonyalderson
Getting the hang of it
Registered: 2003-03-20
Posts: 52
Loc: England
|
thanks lonkero, i've tried your revised script but it doesnt work at present, simply telling me it expects an expression in line 13 which is the 'if isiniprange.......'
not sure why its doing as i'm inexperienced at this but shouldnt i split up my @ipaddress0 and the range i'm looking in somehow. oh and i've drunk half the bottle lads so we need quicker responses lol, but cheers all of you anyway for helping me out, Anth
|
Top
|
|
|
|
#39509 - 2003-04-25 03:37 PM
Re: IsInIPRange Function
|
anthonyalderson
Getting the hang of it
Registered: 2003-03-20
Posts: 52
Loc: England
|
yeah jens i saw that, so if i try it using your example and calling in the outside udf's at the start you think i could tweak it to set the printer up, oh and by the way you're so bloody vague with your replies i can hardly see them on screen lol,
cheers,
Anth
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|