Jasu, this is actually very easy.
You write a second program that does only the network thing (called here "net-pgm"), receiving streams of data from the net, and save them to harddisk.
The procedure is as follows:
1. let your Main Program start the "net-pgm"
After the start, the net-pgm loops looking for a request-file.
As long as there is none it runs hidden in the background doing nothing. And in its loop it controls if the main program is still running. If not it terminates...
2. in your loop of the main-program send a filedownload request to your net-pgm (this can be a file which contains url and savepath).
Now the net-pgm starts downloading the data from the web, while the main-program in its loop looks for a file called "done.txt" or so.
This file will be placed from the net-pgm when the data is completely saved to disk.
3. The main-Program loads the data from harddrive... and deletes the done.txt file... so both programs "know" that the request is finished
4. repeat as often as needed
Instead of using files it is possible to manage all this via TCP between the 2 programs, but when pictures and textures are needed from the web then they have to be placed as files anyway, that's why I nearly always used the "file-method".
You write a second program that does only the network thing (called here "net-pgm"), receiving streams of data from the net, and save them to harddisk.
The procedure is as follows:
1. let your Main Program start the "net-pgm"
After the start, the net-pgm loops looking for a request-file.
As long as there is none it runs hidden in the background doing nothing. And in its loop it controls if the main program is still running. If not it terminates...
2. in your loop of the main-program send a filedownload request to your net-pgm (this can be a file which contains url and savepath).
Now the net-pgm starts downloading the data from the web, while the main-program in its loop looks for a file called "done.txt" or so.
This file will be placed from the net-pgm when the data is completely saved to disk.
3. The main-Program loads the data from harddrive... and deletes the done.txt file... so both programs "know" that the request is finished
4. repeat as often as needed
Instead of using files it is possible to manage all this via TCP between the 2 programs, but when pictures and textures are needed from the web then they have to be placed as files anyway, that's why I nearly always used the "file-method".