jaenster 0 Posted September 24, 2007 (edited) A udf to calucate the broadcastIP. Msgbox(0,"",_BroadcastIP()&@crlf&"Created by jaenster (Thanks to SmOke_N)") Func _SubnetMask($strIP = @IPAddress1) Local $strEnumKey, $nEnum Local $strKey = "HKLM\SYSTEM\CurrentControlSet\" & _ "Services\Tcpip\Parameters\Interfaces\" While 1 $nEnum += 1 $strEnumKey = RegEnumKey($strKey, $nEnum) If @error <> 0 Then ExitLoop If RegRead($strKey & $strEnumKey, "DhcpIPAddress") = $strIP Then Return RegRead($strKey & $strEnumKey, "DhcpSubnetMask") EndIf WEnd Return SetError(1, 0, 0) EndFunc func _BroadcastIP() $submask = _SubnetMask() $split_sub = stringsplit($submask,".") $split_ip = stringsplit(@IPAddress1,".") $Broadcast = "" for $i = 1 to 4 $Broadcast &= "."&bitOR((255-$split_sub[$i]),$split_ip[$i]) next $Broadcast = stringmid($Broadcast,2) return $Broadcast endfunc - Jaenster Edited September 24, 2007 by jaenster -jaenster Share this post Link to post Share on other sites
jaenster 0 Posted October 4, 2007 77 views no replys :/ -jaenster Share this post Link to post Share on other sites
jvanegmond 307 Posted October 4, 2007 Very nice! I am actually learning this now for school, I have a test in the way IP's are built up in a few hours. github.com/jvanegmond Share this post Link to post Share on other sites
karman 0 Posted October 4, 2007 No reply because it sucks. Can you show me when one would need to calculate that address? Waiting.. Share this post Link to post Share on other sites
jvanegmond 307 Posted October 4, 2007 No reply because it sucks.Can you show me when one would need to calculate that address? Waiting..It is useful for people who manage computer networks.. Like system admins. github.com/jvanegmond Share this post Link to post Share on other sites
JRSmile 17 Posted October 4, 2007 No reply because it sucks.Can you show me when one would need to calculate that address? Waiting..it sucks in no way,its very usefull if you want to send a broadcastpacket to discover all dhcp servers in a net.Multicast is used to send files to more then one pc at the same time, which needs the broadcast address to be known.so in any way this function does not suck... ( and please be a bit smarter...) $a=StringSplit("547275737420796F757220546563686E6F6C75737421","")For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])))''Chr("a")&"HI"Next;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Share this post Link to post Share on other sites
big_daddy 20 Posted October 4, 2007 (edited) No reply because it sucks.Can you show me when one would need to calculate that address? Waiting..Are you waiting to be warned? Edited October 4, 2007 by big_daddy Handled matters privately. Share this post Link to post Share on other sites
qwer85 0 Posted October 4, 2007 (edited) Having error at line 23: +>16:48:42 Starting AutoIt3Wrapper v.1.9.3 >Running AU3Check (1.54.9.0) from:C:\Program Files\AutoIt3 +>16:48:42 AU3Check ended.rc:0 >Running:(3.2.8.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\User\Рабочий стол\AutoIt v3 Script.au3" C:\Documents and Settings\User\??????? ????\AutoIt v3 Script.au3 (23) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $Broadcast &= "."&bitOR((255-$split_sub[$i]),$split_ip[$i]) $Broadcast &= "."&bitOR((255-^ ERROR Edited October 4, 2007 by qwer85 Share this post Link to post Share on other sites