Jump to content
Sign in to follow this  
Gui

Testing Proxies with TCPConnect, array issue?

Recommended Posts

Gui

This is the coded section where I test proxies with TCP connect in a listview. It string splits the IP and Port to test em'.

Func pinge()
TCPStartup()
    $l = _GUICtrlListView_GetItemCount($proxies)
For $ii = 0 To $l - 1
    $sItem = _GUICtrlListView_GetItemText($proxies,$ii)
    $tested = StringSplit($sItem,":")
    $ret = TCPConnect($tested[1],$tested[2])
        If $ret = -1 Then
             _GUICtrlListView_DeleteItem($proxies,_GUICtrlListView_FindText($proxies,$sItem))
         ElseIf @error = 1 Then 
              _GUICtrlListView_DeleteItem($proxies,_GUICtrlListView_FindText($proxies,$sItem))
         ElseIf @error = 2 Then
              _GUICtrlListView_DeleteItem($proxies,_GUICtrlListView_FindText($proxies,$sItem))
        EndIf 
            GUICtrlSetData($eeker,'Total Tested : ' & $ii & ' / ' & $l)
            TCPCloseSocket($ret)
Next
    
            GUICtrlSetData($eeker,'Working Proxies : ' & _GUICtrlListView_GetItemCount($proxies) & ' \ ' & $l)
            _GUICtrlListView_DeleteItem($proxies,-1)
EndFunc

After some proxies are tested, it says this.

$ret = TCPConnect($tested[1],$tested[2])

$ret = TCPConnect($tested[1],^ ERROR

>Exit code: 1 Time: 99.117

I donno what it means, was there an error with the string split? Please help. :/

GUI

Share this post


Link to post
Share on other sites
PsaltyDS

You already know what the problem is. Just add some error handling:

For $ii = 0 To $l - 1
    $sItem = _GUICtrlListView_GetItemText($proxies, $ii)
    $tested = StringSplit($sItem, ":")
    If @error Or ($tested[0] < 2) Then
        MsgBox(16, "Error", "Invalid LV item text format:  " & $sItem)
        ContinueLoop
    EndIf
    $ret = TCPConnect($tested[1], $tested[2])

    ; ...

Next

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Gui
;), thanks. I just don't want a message box to show :), because it's completely automated. Thanks for the help, gonna try it now.

Share this post


Link to post
Share on other sites
GEOSoft

;), thanks. I just don't want a message box to show :), because it's completely automated. Thanks for the help, gonna try it now.

Use the timeout capability of MsgBox() or use an alternate method of handleing the error. The point was to get you to use error checking.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Gui

I'm still learning about error handling. Thanks for the help and advice though, it's proving very helpful :). By the way it's working Psalty ;).

Edited by Gui

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×