SFML community forums
Help => Network => Topic started by: SMURF4o0o on July 07, 2015, 11:55:16 am
-
Hey guys I am trying to download an installer via HTTP.
My issue is since the installer can be quite large (currently 400MB with the possibility of growing), when the response is recieved the memory usage jumps as high as 900MB and my program crashes.
I am trying to flush the binary response to a file, so I can make a sillent install later on.
Is it possible to make the response streaming via the HTTP protocol (I am trying to avoid using ftp as that would mean dropping SFTP for FTP protocol, having a dedicated account for the download and so on).
Any suggestions on how to resolve my issue would be greatly appreciated.
Thanks
PS: Awesome Library
-
It's not possible with the sf::Http class and similar, however you can implement it with a bit more work with sockets.
-
Haven't tried it, but you should be able to download the file in multiple parts by setting the proper "Content-range" header (your server has to support that though). E.g. you could download the file in 1-10 mb snippets, each handled by its own thread (just make sure not to overload the computer and network :P).
-
Another low-tech solution would be to just split the file into chunks on the server side, so that you'd be downloading file.1, file.2, file.N individually and then just combine them into one on the client side once all chunks have been downloaded.