lundi 26 février 2018

Socket crash during async_write_some

/*Basic Things has been done.*/
/*Like setting connection and receiving */
namespace bar = boost::asio::error;
void doWrite(char* buffer, size_t size_) {
    boost::asio::async_write_some(socket, boost::asio::buffer(buffer ,size), boost::bind(&Handler, this, bar::error, bar::bytes_transferred));
}

/*handler*/
void handler(/*parameters*/)
{
}

while my server is continuously transferring the data. sometimes client gets crash /*purposely */. errorCode.message() gives error of boost::asio::error::bad_descriptor and whole program crashes. i have copied the program from boost chat server example. how can i prevent even if client abruptly closes. server should not get crash.

Aucun commentaire:

Enregistrer un commentaire