0

I have a C++ Server that a client application is able to connect to but after the client connect the server crashes. I found the code causing it by commenting it out and it not crashing anymore. The part that crashes is when it gets ready to read, I know it doesn't get past this point cause it crashes before I send a message from the client. bellow is the read code

try
{
    Logger::Log("Client Listing for message!");
    boost::asio::async_read(socket_,
        boost::asio::buffer(readMsg_.Data(), Message::header),
        boost::bind(&Client::HandleReadHeader, this,
        boost::asio::placeholders::error));
}
catch (std::exception& e)
{
    Logger::Log("Error: " + std::string(e.what()));
}

edit: The try-catch statement doesnt catch anything it just crashes so I am unsure what is wrong

Edit*: I recreated the GUI project witch starts this code, witch is a dll. After I recreated that project, no changes besides different project in the solution, It no longer crashes but the throw-catch statement now catches a error.

Error: The network connection was aborted by the local system

not sure why it's getting aborted

Cœur
  • 37,241
  • 25
  • 195
  • 267
Shredder2500
  • 1,065
  • 2
  • 11
  • 26
  • Can you give additional information about the crash? Any message generated from/by the crash would be very useful. – Mark Garcia Aug 11 '13 at 02:54
  • @MarkGarcia Just posted the crash details. – Shredder2500 Aug 11 '13 at 02:57
  • [This question and its answers](http://stackoverflow.com/questions/4550207/what-are-the-causes-and-solutions-of-exception-code-c0000005-in-mscorwks-dll) might help you. – Mark Garcia Aug 11 '13 at 03:00
  • ok so I found out that there was just somthing wrong with the project itself, not the server one but the GUI one cause it stoped loading the server.dll even with it there. So I re created the project, that wasnt hard just a text box for logs right now and then it crashed with a stack error, that was cause I was deleting the object on error so i removed that that error is gone so now There is no crashing just a error. The Network connection was aborted by the local system. not sure why should I past some code here or start a new question? – Shredder2500 Aug 11 '13 at 03:46

1 Answers1

0

The Crashing was just something weird going on with the project. I recreated the project but changed nothing and the crashing stop and the try-catch picked up an error. The error was me deleting the object on the error. Then I got a error witch was for local system closed the connection, That was cause by me forgetting to use shared_from_this() instead of this.

Shredder2500
  • 1,065
  • 2
  • 11
  • 26