Jump to content

Recommended Posts

Posted (edited)

Hello, 

I have A simple question about http request. What would be the fastest way to send mupltiple http request at the same time with autoit? The only way i figured  out was to to start multiple processes. This way works fine but its not really a good way. What user would like to see 15 processes running in the background at the same time. I know multithread is also not available in autoit.

Edited by paradox109
Posted

ObjCreate('WinHttp.WinHttpRequest.5.1')

Mode: Async = True

In Loop use: .WaitForResponse(0)

That is my suggestion to you 😙

Posted (edited)
11 hours ago, Nine said:

what is your aim ? DDoS ?

Aim is to get information faster from API's. As i said before i already have couple projects that works with multiprocessing.  

Edited by paradox109
Posted
12 hours ago, moimon said:

ObjCreate('WinHttp.WinHttpRequest.5.1')

Mode: Async = True

In Loop use: .WaitForResponse(0)

That is my suggestion to you 😙

Interesting i will look it up

Posted

Example multi request 10 pages website:

Local $Thread = 10
Local $oWH[$Thread]
Local $ThreadCompleted[$Thread]
Local $CheckCompleted = 0
Local $AsyncMode = True

For $i = 0 To $Thread - 1
    $oWH[$i] = ObjCreate('WinHttp.WinHttpRequest.5.1')
    $oWH[$i].Open('GET', 'http://autoitvn.com/forums/thao-luan-hoi-dap/page-' & ($i + 1), $AsyncMode)
    $oWH[$i].Send()
Next

Do
    For $i = 0 To $Thread - 1
        If $ThreadCompleted[$i] = 0 And $oWH[$i].WaitForResponse(0) = True Then ;$ThreadCompleted[$i] variable condition to prevent loop result
            ConsoleWrite('>Page ' & $i & ' completed:' & @CRLF & $oWH[$i].GetAllResponseHeaders & @CRLF)
            $ThreadCompleted[$i] = 1
            $CheckCompleted += 1
        EndIf
    Next
Until $CheckCompleted = $Thread

MsgBox(0, 'Hi', 'Completed')

This method works very fast and do not use as much CPU and RAM resources as multi process

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
×
×
  • Create New...