Jefrey Sobreira Santos Jefrey Sobreira Santos - 1 month ago 5x
HTTP Question

WinHTTP and MSXML hangs on .Send() forever

I'm trying to create an app that connects several times to an internal API on my office. These are simple GET requests to a server on the same network (accessed through IP). But in some of our machines, the

hangs forever. Here is the code:

Func get_url($RequestURL)
;Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") ; didn't work too
Local $oHTTP = ObjCreate("MSXML2.ServerXMLHTTP.3.0")
$oHTTP.Open("GET", $RequestURL, False)
if $oHTTP.status == 200 Then
Return $oHTTP.ResponseText
Return SetError($oHTTP.status, 0, False)

While the same code worked well in some machines, in other, it hangs forever on the
. On these machines, however, I can connect to the IP using telnet, netcat and any web browser without any problem. The firewall is turned off on both sides.

While researching about it, I saw that it's not just me who face this problem, but none of the topics I found had a solution. Was this feature deprecated? If so, what's a replacement?


Well the solution is as weird as the bug itself.

Just added InetGet("") at the script starting and everything works normally.

Perhaps Windows does not allow apps to open sockets after some time without a socket opened... Or it's really a bug (as I see topics around the web about this bug that are older even than me, I do think so).