cageman 4 Posted September 4, 2010 (edited) 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 September 4, 2010 by cageman Share this post Link to post Share on other sites
trancexx 1,013 Posted September 4, 2010 _WinHttpCloseHandle($hRequest) should be inside the loop. Currently you are closing only the last one. ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
cageman 4 Posted September 5, 2010 Thx, hopefully that is the mistake that caused it. Share this post Link to post Share on other sites