[Gambas-user] HTTPClient freeze after 40 mins with Gambas 3.18.4

Christof Thalhofer chrisml at deganius.de
Thu Sep 28 22:56:37 CEST 2023


Am 28.09.23 um 22:06 schrieb Benoît Minisini:

> How do you use exactly your HttpClient object? Which properties do you
> set with which values? Which methods do you call with which arguments?

This is the Get() function which does the job:

> Private $H As New HttpClient As "HClient"
> > Public Function Get() As String
> 
>     Dim sBuffer As String
> 
 >     ' $H.URL is filled at another place
>     If $H.URL Then
> 
>         $H.Async = False
>         $H.Timeout = 600
> 
>         $H.Get
> 
>         ' Success - read the data
>         If Lof($H) Then sBuffer = Read #$H, Lof($H)
> 
>         If $H.Code > 299 Then
>             Error.Raise("Degapp Fehler – Code " & $H.Code & " " & sBuffer)
>         Endif
> 
>         If $H.Status < 0 Then
>             Error.Raise("Connection zu Degapp kaputt. Curl Status (" & $H.Status & ") kleiner 0.")
>         Else
>             $H.Close
>             Return sBuffer
>         End If
>     Else
>         Error.Raise("Der Pfad für Degapp ist nicht definiert.")
>     Endif
> 
> End

It's inspired from code in

http://gambaswiki.org/wiki/comp/gb.net.curl/httpclient

Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230928/e5927915/attachment.sig>


More information about the User mailing list