LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   webserver & client application (https://www.linuxquestions.org/questions/programming-9/webserver-and-client-application-148424/)

nakkaya 02-20-2004 11:35 AM

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....

PSIplus 02-20-2004 11:40 AM

I'm not sure, but how do you handle the signals from the communication?


All times are GMT -5. The time now is 04:20 AM.