cageman Posted September 4, 2010 Share 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 Link to comment Share on other sites More sharing options...
trancexx Posted September 4, 2010 Share Posted September 4, 2010 _WinHttpCloseHandle($hRequest) should be inside the loop. Currently you are closing only the last one. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
cageman Posted September 5, 2010 Author Share Posted September 5, 2010 Thx, hopefully that is the mistake that caused it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now