Android Question HttpUtils2Service problem...

ilan

Expert
Licensed User
Longtime User
i have a problem with the HttpUtils Service

i am trying to download a string and everything is ok, the problem is after i update the textfile on my server the app downloads the old text. if i enter the address to the textfile in my browser i am getting the new text.

if i use ftp download in my app i am also getting the new string.
but with httputils i am getting the old text and only after a while or app restarts i am getting the new text.

what could be the reason for that? why i am not getting the new text immidiatly after uploading the file?

could it be that i need to clear the "TempFolder = File.DirInternalCache" ?? and if yes how?
 

ilan

Expert
Licensed User
Longtime User
HttpUtils2 doesn't cache anything. Make sure that Job.Success is true. It is probably your server who sends the same file. You can try to add a "dummy" parameter to the link:
B4X:
YourLink & "?dummy=" & DateTime.Now

but the same file is no more available, how can it be that its downloading the file??

here is an example:

i have deleted this file in my server: http://www.sagital.byethost7.com/lists/0504844663.txt
if you will put http://www.sagital.byethost7.com/lists/0504844663.txt in your browser you will get an error...

but the app still download the file like its exists...
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi Ilan,

could it be that your app doesn't load again the now un-existent file but simply accesses a local temp copy you made along its first original download?
I mean something like:
B4X:
....
if successful the
  copy to local dir
end if
release job
call sub "next step"
end sub

sub next step
  access local file
  proccess it
end sub
In the above scheme, when download is unsuccessful, "next step" is called anyway (and it finds "the" file).
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
i am saving the text i am downloading to a file but i am looking in my logs and i see the old text again and again also after i have uploaded a new file
only after about 10min i see the updated text

i cannot explain that issue...

B4X:
Case "Job3"    
        txtsh3 = " "
         Log(txtsh3)
                 txtsh3 = job.GetString
                 Log(txtsh3)
'.....

as you can see first i reset the string "txtsh3" to "" then check in logs that its really blank then download the job and check again in logs...
before i did anything...
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Did you DIm a New httpjob each time vor are you using the same jobobject each time?
 
Upvote 0

udg

Expert
Licensed User
Longtime User
is it possible?
Why not?
Just call job.release while closing the JobDone sub and dim a job again before next download execution.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
could it be because i am using a Free FTP server? byethost7.com

i have also a paid one but cannot access it from my app (Filezilla FTP) :(
 
Upvote 0

udg

Expert
Licensed User
Longtime User
I'd have suspected a caching on the server if you weren't exeperiencing an immediate new data availability from browser and ftp client.
So it appears that the GET from httputils is worked on differently by the server than the one from the browser and that's sounds strange.
I guess you don't need suggestion on how to circumvent the problem since you're more interested in understanding why it happens at all (me too :) ).
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
I guess you don't need suggestion on how to circumvent the problem since you're more interested in understanding why it happens at all

yep, i have solved the problem by downloading the file via FTP (Http would be simpler) so my app is working but still as you said i would like to understand why its doing it..
 
Upvote 0
Top