HTTPTimeout

Just starting out? Need help? Post your questions and find answers here.
fluent
User
User
Posts: 72
Joined: Sun Jan 24, 2021 10:57 am

HTTPTimeout

Post by fluent »

For a bunch of reasons I need to stay on PB 5.73 LTS for now, and it does not have the HTTPTimeout() command.

Does anyone know what internal API command HTTPTimeout() uses (for Windows), so I could use that instead?

Code: Select all

 HTTPTimeout(5000) ; Allows 5 secs to connect to the server

  HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com")
  If HttpRequest
    Debug "StatusCode: " + HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode)
    Debug "Response: " + HTTPInfo(HTTPRequest, #PB_HTTP_Response)
    
    FinishHTTP(HTTPRequest)
  Else
    Debug "Request creation failed"
  EndIf
 
BarryG
Addict
Addict
Posts: 4118
Joined: Thu Apr 18, 2019 8:17 am

Re: HTTPTimeout

Post by BarryG »

I'd look at starting a timer in a thread and once the timeout is reached, use AbortHTTP() to kill the connection? I haven't tried this.
Post Reply