RottNet - Streaming files?

Blitz3D Forums/Blitz3D Programming/RottNet - Streaming files?

Guy Fawkes(Posted 2012) [#1]
Hello all. Ive been messing with Rottnet. A WONDERFUL plugin I must say indeed.. Now I have a simple question... How do I stream anything like music and 3d models from the server, to the client?

Here's my code so far:


Server.bb:




Client.bb:



Thank You for all your help! :)


Adam Novagen(Posted 2012) [#2]
How do I stream anything like music and 3d models from the server, to the client?
One byte at a time.

And while there's a bit of cheek in that remark, no, I really do mean one byte at a time; it pretty much comes down to that. HOWEVER, I believe that - advanced programmers please correct me on this - UDP should not be used for actual media downloads like models and sounds. Literal streaming is like YouTube, it means that it downloads some audio/video data, then plays what it's downloaded so far while it downloads the rest. For this, reliability is not a huge concern, whereas speed is key.

For getting actual game resources, though, TCP should be used. It's slower per small packet of data, but the slow speed is caused by the fact that it's sent reliably and in order. When you want an "error-free" one-shot download, TCP is the protocol you want, not UDP. I'm assuming that this is what you need here, because you can't actually "stream" a 3D model.

I may live to regret this, but here's a completely successful HTTP download program, that grabs the "german.gif" flag icon from the top-left corner of this website, and saves it in the program's folder. The code can be (relatively) easily adapted to suit any file on the internet. See what you can make of it.




Guy Fawkes(Posted 2012) [#3]
Thanks. I just tried this, however.. for some reason, the downloaded file was corrupt. I couldnt open it...

Also, can this download huge files as well?


Guy Fawkes(Posted 2012) [#4]
Better yet.... I found a working code... sort of.... Its saying that the file german.gif does not exist, when it clearly does when it loads... why is that?





Guy Fawkes(Posted 2012) [#5]
NVM. Problem solved :)

I used FreeImage :D


Guy Fawkes(Posted 2012) [#6]
Is there any way that someone can modify this code to download files that look like this? : http://mywebsite.com/downloads2.php?download_file=MyGame.rar

Note: You need the FreeImage plugin to use this code, which you can get, here: http://www.blitzbasic.com/codearcs/codearcs.php?code=1732



Last edited 2012


Guy Fawkes(Posted 2012) [#7]
Anyone? :/


Guy Fawkes(Posted 2012) [#8]
Ok. Ive come up with a code that can stream content into blitz... Problem is... the content I need to stream from, is a file on the internet..

How do I make this code download HUGE files, and stream them to blitz? Im interested in finding out how to stream a file from the internet to blitz :)

Here's the code:




Thanks everyone for all your help! :)