webserver & client application
i am working on a simple web server everything works fine execpt one things
the thing is when sending an file from the server to the client(this case the browser) if i press the stop button on the browser my server crashes.. this is the part of the code that causes the crash
bool Server::SendHtmlToSocket()
{
std::ifstream InputFile;
if(ReturnCode==404)
{
InputFile.open("html/error.html");
}
else
{
InputFile.open(request.c_str());
}
std::string DataSend;
char ch;
while(!InputFile.eof())
{
InputFile.get(ch);
DataSend=ch;
if ( ! Socket::send ( DataSend ) )
{
throw SocketException ( "Could not send html file to socket." );
}
}
InputFile.close();
}
socket::send just calles the send system call with correct parameters.....
can anyone point me what am i doing wrong thx....
|