Page 1 of 1

HTTPTimeout

Posted: Sat Mar 29, 2025 10:38 am
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
 

Re: HTTPTimeout

Posted: Sat Mar 29, 2025 10:41 am
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.