Android Question HttpUtils2Service problem...

Discussion in 'Android Questions' started by ilan, Mar 20, 2015.

  1. ilan

    ilan Expert Licensed 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?
     
  2. Erel

    Erel Administrator Staff Member Licensed 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:
    Code:
    YourLink & "?dummy=" & DateTime.Now
     
  3. ilan

    ilan Expert Licensed User

    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...
     
  4. udg

    udg Expert Licensed 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:
    Code:
    ....
    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).
     
  5. ilan

    ilan Expert Licensed 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...

    Code:
    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...
     
  6. DonManfred

    DonManfred Expert Licensed User

    Did you DIm a New httpjob each time vor are you using the same jobobject each time?
     
  7. ilan

    ilan Expert Licensed User

    yes
     
  8. DonManfred

    DonManfred Expert Licensed User

    yes same or yes dim each time a new? :)
     
  9. ilan

    ilan Expert Licensed User

    i use the same job always again and again...

    the app is looking every 30 sec for a new file and if there is one it downloads it... how can i creat every time a new Job??

    is it possible?
     
  10. udg

    udg Expert Licensed User

    Why not?
    Just call job.release while closing the JobDone sub and dim a job again before next download execution.
     
  11. ilan

    ilan Expert Licensed User

    jobDone got allready Job.Release and every time i dim a job (but with the same name)
     
  12. DonManfred

    DonManfred Expert Licensed User

    That´s what i wanted to know.OK. This should work then...
    hmmm
     
  13. ilan

    ilan Expert Licensed 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) :(
     
  14. udg

    udg Expert Licensed 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 :) ).
     
  15. ilan

    ilan Expert Licensed User

    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..
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice