Alex Black
2009-08-05 18:22:08 UTC
I'm experimenting with turning off the Nagle algorithm to possibly
improve the performance of my socket server, I'm processing lots of
small requests and I'd like as little latency as possible.
Here is a code snippet:
void CBaseWebServer::StartAccept()
{
try
{
shared_ptr<tcp::socket> pSocket(new
tcp::socket(m_IoService));
boost::asio::ip::tcp::no_delay option(true);
pSocket->set_option(option);
m_pAcceptor->async_accept(*pSocket,
bind(&CBaseWebServer::HandleAccept, this, pSocket,
boost::asio::placeholders::error));
}
catch ( ... )
{
cout << "Unexpected exception caught in " <<
BOOST_CURRENT_FUNCTION << endl <<
boost::current_exception_diagnostic_information();
}
}
I'm getting an exception on the set_option line:
Unexpected exception caught in void CBaseWebServer::StartAccept()
Throw in function (unknown)
Dynamic exception type:
N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6syst
em12system_errorEEEEE
std::exception::what: Bad file descriptor
What am I doing wrong here? Thanks!
- Alex
improve the performance of my socket server, I'm processing lots of
small requests and I'd like as little latency as possible.
Here is a code snippet:
void CBaseWebServer::StartAccept()
{
try
{
shared_ptr<tcp::socket> pSocket(new
tcp::socket(m_IoService));
boost::asio::ip::tcp::no_delay option(true);
pSocket->set_option(option);
m_pAcceptor->async_accept(*pSocket,
bind(&CBaseWebServer::HandleAccept, this, pSocket,
boost::asio::placeholders::error));
}
catch ( ... )
{
cout << "Unexpected exception caught in " <<
BOOST_CURRENT_FUNCTION << endl <<
boost::current_exception_diagnostic_information();
}
}
I'm getting an exception on the set_option line:
Unexpected exception caught in void CBaseWebServer::StartAccept()
Throw in function (unknown)
Dynamic exception type:
N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6syst
em12system_errorEEEEE
std::exception::what: Bad file descriptor
What am I doing wrong here? Thanks!
- Alex