Download and read the file

hola,
I’m trying to create a way to check if exists a version
higher for current version.

In the code bellow I download the file, check if it exists
but can not show the content within the file.
Inside the file is one numerical value.
I can only read the value if i put a pause of 3s :expressionless:

any ideas?
Is possible to read the content on the web instead of downloading the file?

  dim socket1 as new HTTPSocket
  check = new FolderItem("ver.dat")
  socket1.get("http://lms1.web.simplesnet.pt/ver.dat", check)
  
  e = getfolderitem("ver.dat")
  if e <> nil and e.exists = true then
    
    stream = e.openastextfile
    versr = stream.readline
    MsgBox(versr)
    
  end if

Thanks,
Rui

Subclass your socket and use the DATAAVAILABLE event…

You need to wait until the download is complete… could be seconds, minutes… depends on file size, traffic etc.