When i try to download a set of files using stream sockets over an HTTP protocol, it only gets data from the first file i try to download.
Assume a loop like the following...
char* file = (char*) malloc(enough_space);
char page[] = {"www.foobar.com"};
for(int n=0 ; n<10 ; n++)
    {
        sprintf(file, "file%i.html", n);
        fopen(file, "wb");
        sprintf(request, "GET %s HTTP/1.1\nHost: %s\n\n", file, page);
        write( socket, request, strlen(request) );
        read_file(output_file);
        fclose(output_file);
    }
Where a connection has been established first.
This code would give me file1.html, including its header from the server.. But only the first file, and this puzzles me.. What will i have to do in order to get them all?
Thanks up front.