What i have done so far:
I have coded a program that makes a socket and allows a client to connect to it. To connect to the program i type in the web browser "http://localhost:8080/
I have tried to connect to this program with both firefox and IE. It works fine.
The part I need help with is how to send the html page to the webbrowser so that the browser displays it. I have tried to look at the binary section in:http://www.cplusplus.com/doc/tutorial/files/
// reading a complete binary file
#include <iostream>
#include <fstream>
usingnamespace std;
ifstream::pos_type size;
char * memblock;
int main () {
ifstream file ("example.bin", ios::in|ios::binary|ios::ate);
if (file.is_open())
{
size = file.tellg();
memblock = newchar [size];
file.seekg (0, ios::beg);
file.read (memblock, size);
file.close();
cout << "the complete file content is in memory";
delete[] memblock;
}
else cout << "Unable to open file";
return 0;
}
I tried to send the memblock variable with the sockets send() function but the browser wont react. I guess i am doing something wrong =( could you Pleeaas help me out here?
I have a large comment in the code that shows what part i need help with