[MAXGUI] Download files over internet?

BlitzMax Forums/BlitzMax Beginners Area/[MAXGUI] Download files over internet?

Grisu(Posted 2006) [#1]
Morning all.

Are there any newbie friendly functions / modules to download/upload files over the internet?

My app needs to download ogg files and textdata for updates.
Has not to be extremely fast! (Win32/Mac/Linux if possible)

Grisu


Beaker(Posted 2006) [#2]
Ftp or Http?


Grisu(Posted 2006) [#3]
http and download only will do for now.

I don't know how I would be able to upload stuff anyway = Newbie.


Yan(Posted 2006) [#4]
bank:TBank = LoadBank("http::www.google.co.uk/intl/en_uk/images/logo.gif")
SaveBank(bank, "c:/google logo.gif")



Perturbatio(Posted 2006) [#5]
I'd imagine uploading could be done by sending data via a stream to your server side app (php script, compiled executable or whatever) and you then write it to disk. You just need to be sure that it's hacker safe.

(i.e. don't allow people to upload a cgi-script of their choice that they can then run on your server). Uploading to a directory that has no execute permissions would be a good start.


Grisu(Posted 2006) [#6]
@ Ian:
Nice and simple.
Can I display "downloadspeed", "time left", etc?

@ Perturbatio: Thanks for info. Think I will leave that aside for the moment. Too risky.


xlsior(Posted 2006) [#7]
Can I display "downloadspeed", "time left", etc?


Not with the built-in commands -- since they are not threaded, the application itself will not be able to do anything else while it is downloading the file, which includes printing anything to the screen.


Azathoth(Posted 2006) [#8]
Possibly with streams?


Grisu(Posted 2006) [#9]
So basicly the whole app "hangs" if I download bigger files.
And I can't show a progress bar and such "normal" informations... :/

*puts multi-threadding on his long bmx whishlist...


Azathoth(Posted 2006) [#10]
You can use streams and/or sockets to do this, there is an example in the docs under ReadStream showing how to read a webpage line by line.


Yan(Posted 2006) [#11]
Sorry Grisu, I missed this earlier.

As Azathoth has said, you can do this with a TCP stream. I'm a bit tied up at the moment, but I'll post an example tomorrow.

[edit]
Okay, I sorted things quicker than expected.
It's not pretty, but it should give you the general idea.

[/edit]


Grisu(Posted 2006) [#12]
Yepp, it does!
I think I can take over here.. :)
Thanks!