CRAP I MESSED UP GUYS SORRY! I messed up and 2.0 scanned every other port due to a math problem I didn't notice. This is 2.5 it has some tiny changes and the big change of scanning every port. Sorry once again I didn't notice this earlier.
#include <guiconstants.au3>
$PortScanner = GUICreate("Infinitex0's Port Scanner", 300, 175)
GUICtrlCreateGroup("Port Scan", 5, 5, 275, 160)
$IPLabel = GUICtrlCreateLabel("IP", 20, 17)
$PortIPAddress = GUICtrlCreateInput("127.0.0.1", 20, 33, 125)
GUICtrlCreateLabel("Start on Port", 20, 55)
$PortStartNumber = GUICtrlCreateInput("1", 20, 68, 125)
GUICtrlCreateLabel("End on Port", 20, 91)
$PortEndNumber = GUICtrlCreateInput("30", 20, 108, 125)
$StartScan = GUICtrlCreateButton("Start", 20, 135, 125)
GUICtrlSetFont($StartScan,15)
$OnPort = GUICtrlCreateLabel("Scanning Port:None", 150, 142)
GUICtrlCreateGroup("Open Ports", 160, 17,105, 125)
$OpenPortList=GUICtrlCreateList("", 168, 30, 90, 109)
GUICtrlCreateGroup ("",-99,-99,1,1)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_ClOSE
ExitLoop
Case $msg = $StartScan
_StartScan()
EndSelect
WEnd
Func _StartScan()
$PortIP=GUICtrlRead($PortIPAddress)
$PortEndNumberB=guictrlread($PortEndNumber)
$PortStartNumberB=guictrlread($PortStartNumber)
TCPStartup()
$timerstart = TimerInit()
For $LetsGo = $PortStartNumberB To $PortEndNumberB
$socket = TCPConnect($PortIP,$PortStartNumberB)
ControlSetText("", "", $OnPort, "Scanning Port:" & $PortStartNumberB & "")
If $socket = -1 Then
$PortStartNumberB = $PortStartNumberB + 1
Else
GUICtrlSetData($OpenPortList,$PortStartNumberB)
$PortStartNumberB = $PortStartNumberB + 1
EndIf
Next
TCPShutdown()
$timerend = TimerDiff($timerstart)
TrayTip("Port Scanner", "Done Process took " & Round($timerend,-1)/1000 & " seconds", 7, 1)
EndFunc