Thanks for the replies..
OK, well this is my current function:
Code:
int SendFile(char *FileName)
{
HANDLE hFile;
DWORD dwNumRead;
BOOL bFile;
char FilePath[1000];
char Response[1000];
sprintf(FilePath, "c:\\webserver\\%s", FileName);
hFile = CreateFile(FilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
bFile = ReadFile(hFile, HtmlWhole, sizeof(DWORD)*256, &dwNumRead,NULL);
bFile = CloseHandle(hFile);
printf(HtmlWhole);
sprintf(Response, "HTTP/1.1 200 OK\r\nDate: Sun, 05 Jun 2005 22:15:06 GMT\r\nContent-Length: %d\r\nContent-Type: text/html\r\nCache-Control: private\r\nServer: Server/1.0\r\n\r\n", strlen(HtmlWhole);
printf(Response);
send(theClient, Response, sizeof(Response), 0);
send(theClient, HtmlWhole, sizeof(Response), 0);
return 0;
}
When I attempt to send 'test.html':
Code:
<title>title</title>
<b>test</b>
The value of strlen(HtmlWhole) is 31, and strlen(Response) is 145.
I know about the bandwidth problem, but I will be fixing that after I get the sending working.