Consume a web page output as it is received before the whole page arrives

DKnowles

Member
Licensed User
Longtime User
Hi All

I have a web page that reports back how an uploaded database file is being processed (the upload is completed via ftp before the web page is called)

e.g. I use FTP to upload a sqllite.db to the server and once it has been successfully upload I call the web page to process the database file.

The processing of this file can just take a couple of seconds or a couple of mins depending how many 100's of readings are in the database and need processing.

The web page outputs a single line for each record that is processed and sends this back to the android application.

What I want is to get each of these lines BEFORE the whole page is finished.

This is to allow me to update the screen so the user does not think the upload has failed when we have a long processing cycle.

I'm using httpUtill2 to do the web request.

note the streaming of the web page works fine, all I'm after is how to get basic4android to eat up the incoming information.

David :sign0085:

ps Erel HttpUtils2 far easier to understand than the previous version.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no simple way to do it. The response is written asynchronously to the output stream passed to Response.GetAsynchronously. When the response is completed the event is raised.

You can create a memory stream by calling OutputStream.InitializeToBytesArray. You can then use a timer to check if there is new data in this stream. Alternatively you can do it with a file.
 
Upvote 0

DKnowles

Member
Licensed User
Longtime User
Thanks, was looking at the file / separate http Job

Thank Erel

Will finish the post with a example, if I get it working!!!
 
Upvote 0
Top