Hi !
I have an app that use httpcli like this:
The string that the server sent is about 30 to 40 bytes only and worked fine.
But now the string will be about 3 to 4 Kbytes.
My questions are :
1 - Is better to use GetAsynchronously like this :
2 - Or use httputils like this :
This app will get data about each 2 seconds.
I am afraid of the use of file.OpenOutput will use too much the flash memory of the device and make it degraded with time ...
3 - Is there a way to use the internal RAM to store the received data ?
Thanks
Rubens Jr.
I have an app that use httpcli like this:
B4X:
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
my_rotine (Response.GetString ("UTF8"))
Response.Release
End Sub
The string that the server sent is about 30 to 40 bytes only and worked fine.
But now the string will be about 3 to 4 Kbytes.
My questions are :
1 - Is better to use GetAsynchronously like this :
B4X:
Sub hb_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Response.GetAsynchronously("Response", File.OpenOutput(File.DirInternalCache, "temp.txt", False), True, TaskId)
End Sub
Sub Response_StreamFinish (Success As Boolean, TaskId As Int)
If Success Then
Dim in As InputStream
in = File.OpenInput(File.DirInternalCache, "temp.txt")
....
2 - Or use httputils like this :
B4X:
Sub JobDone (Job As String)
Dim s As String
If HttpUtils.IsSuccess(b4a) Then
s = HttpUtils.GetString(b4a)
End If
End Sub
This app will get data about each 2 seconds.
I am afraid of the use of file.OpenOutput will use too much the flash memory of the device and make it degraded with time ...
3 - Is there a way to use the internal RAM to store the received data ?
Thanks
Rubens Jr.