Test file download lib please

Blitz3D Forums/Blitz3D Programming/Test file download lib please

@rtur(Posted 2007) [#1]
Test this little sample:
http://www.smallfreegames.com/test/Download.zip
It is trying to download 3 small files from internet.
I'm especially intrested in tests on computers that connected to internet not directly. Througts proxy servers or something like this.


Mikele(Posted 2007) [#2]
Works fine.
Net connection by the router with a firewall.


@rtur(Posted 2007) [#3]
Thanks Mikele.

2 All
Nobody else intrested in file downloading lib for Blitz3D, that allow download files in background througt http request automaticaly finding proxy settings etc?

Here is source of sample:
Type FileDownloadT
        Field FileHandle%
        Field Completed%

        Field RemoteFileName$
        Field LocalFileName$
        Field BytesDownloaded%
        Field SizeOfFile%
End Type

DownloadFile("http://smallfreegames.com/test/Hero1.jpg",  "Hero1.jpg")
DownloadFile("http://smallfreegames.com/test/Hero2.jpg",  "Hero2.jpg")
DownloadFile("http://smallfreegames.com/test/screen.xml", "test.xml")

While Not (AllDownloadsCompleted() Or KeyDown(1))
        Cls
        i=0
        For this.FileDownloadT=Each FileDownloadT
                i=i+1
                ;If DStat%(this\FileHandle, 4)=1 Then DebugLog DStat%(this\FileHandle, 3)
                Select DStat%(this\FileHandle, 4)
                        Case 0
                                Text 10,10+i*20,"File "+Str(i)+" downloading..."
                        Case 1
                                Text 10,10+i*20,"File "+Str(i)+" downloaded."
                        Case 2
                                Text 10,10+i*20,"File "+Str(i)+" failed."
                End Select
        Next
        Flip
        Delay 1
Wend

Cls
Print "All files downloaded."
WaitKey()
End


Function AllDownloadsCompleted()
        For this.FileDownloadT=Each FileDownloadT
                If this\Completed=False
                        If DStat%(this\FileHandle, 4)=False Then Return False
                EndIf
        Next
        Return True
End Function


Function DownloadFile(URL$, LocalFileName$)

        this.FileDownloadT=New FileDownloadT
        this\RemoteFileName$=URL$
        this\LocalFileName$=LocalFileName$

        this\FileHandle=URL2File(this\RemoteFileName$,this\LocalFileName$,True)
        this\SizeOfFile%=DStat(this\FileHandle,3)
        DebugLog this\SizeOfFile%
        this\Completed=False

        Return Handle(this)

End Function



Yeshu777(Posted 2007) [#4]
Yep, works for me also.. networked pc connected to internet via a server, firewalled, encased in conrete and buried at sea.