ChristophX86

IPAddrv4ToInt32

Mar 16th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.39 KB | None | 0 0
  1. TCPStartup()
  2. ConsoleWrite("http://" & IPAddrv4ToInt32(TCPNameToIP("www.google.com")) & "/" & @CRLF)
  3. TCPShutdown()
  4.  
  5. Func IPAddrv4ToInt32($ipaddrv4)
  6.     $ipaddrv4 = StringRegExp($ipaddrv4, "^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$", 3)
  7.     If @error Then Return SetError(1, 0, -1)
  8.     Local $int32 = 0, $i
  9.     For $i = 0 To 3 Step 1
  10.         $int32 += $ipaddrv4[$i] * 256^(3-$i)
  11.     Next
  12.     Return $int32
  13. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment