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

Benoît Minisini benoit.minisini at gambas-basic.org
Thu Sep 28 23:17:57 CEST 2023


Le 28/09/2023 à 22:56, Christof Thalhofer a écrit :
> 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
> 

Do you run the event loop between two calls to Get()?

-- 
Benoît Minisini.



More information about the User mailing list