Jump to content

some winHTTP requests are not processed


cageman
 Share

Recommended Posts

At the moment i have a php file that gathers data from a specific link and stores it in a database. If i let the php file write every link that needs to be processed it doesn't correspond with the amount of requests made. So i suspect that somehow all these fast requests, which are a few thousand, are not all processed. Does this script keep making new connections or does it use one only? It seems that somehow too many connections are made and not all requests come through. I am just guessing and debugging didn't help me so far.

Here is the part of my code i am talking about. $links is an array with all the links that need to be processed.

func get_data($links)
Local $hOpen, $hConnect, $hRequest
    
$hOpen = _WinHttpOpen()  
$hConnect = _WinHttpConnect($hOpen, "localhost")     

For $i = 2 to UBound($links)-1 Step 1
sleep(250)
$hRequest=_WinHttpOpenRequest($hConnect, "GET", "/get_data.php?linkid="& $links[$i], "HTTP/1.1",$WINHTTP_NO_REFERER,"*/*")     

if NOT _WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS) Then
ConsoleWrite("request not done, error is: " & @error & @CRLF & @CRLF)   
EndIf
Next

    _WinHttpCloseHandle($hRequest)     
    _WinHttpCloseHandle($hConnect)     
    _WinHttpCloseHandle($hOpen)   
EndFunc

edit:

i did some more debugging while this thread is up. It seems that suddenly the amount of connection is too much indeed. I get a @error=1 after a lot of connections and then it seems only new connections are made if there is a spot open.

my current new solution is to just try to make the request until it works again with a sleep if a few seconds in between tries. Any other ideas on how to solve this?

Edited by cageman
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...