HTTPProgress()

Syntax

Result = HTTPProgress(HttpConnection)
Description
Returns the progress of the specified asynchronous download, started either with ReceiveHTTPFile() or ReceiveHTTPMemory().

Parameters

HttpConnection The HTTP connection to monitor.

Return value

The status of the download. It can be the current number of recieved bytes or one of the following value:
  #PB_Http_Success    : the download has been successfully finished.
  #PB_Http_Failed     : the download has failed.
  #PB_Http_Aborted    : the download has been aborted with AbortHTTP().

Example

  InitNetwork()

  Download = ReceiveHTTPMemory("http://www.purebasic.com/download/OgreAssimpConverter.zip", #PB_HTTP_Asynchronous)
  If Download
    Repeat
      Progress = HTTPProgress(Download)
      Select Progress
        Case #PB_Http_Success
          *Buffer = FinishHTTP(Download)
          Debug "Download finished (size: " + MemorySize(*Buffer) + ")"
          FreeMemory(*Buffer)
          End

        Case #PB_Http_Failed
          Debug "Download failed"
          End

        Case #PB_Http_Aborted
          Debug "Download aborted"
          End
          
        Default
          Debug "Current download: " + Progress
       
      EndSelect
      
      Delay(500) ; Don't stole the whole CPU
    ForEver
  Else
    Debug "Download error"
  EndIf

See Also

ReceiveHTTPFile(), ReceiveHTTPMemory()

Supported OS

All

<- GetURLPart() - Http Index - ReceiveHTTPFile() ->