28 #include <boost/asio.hpp>
87 boost::system::error_code ec;
88 m_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
100 asio::ip::tcp::resolver::query query(host, stdext::unsafe_cast<std::string>(port));
104 m_readTimer.expires_from_now(boost::posix_time::seconds(
static_cast<uint32>(READ_TIMEOUT)));
113 m_readTimer.expires_from_now(boost::posix_time::seconds(
static_cast<uint32>(READ_TIMEOUT)));
136 os.write((
const char*)buffer, size);
153 m_writeTimer.expires_from_now(boost::posix_time::seconds(
static_cast<uint32>(WRITE_TIMEOUT)));
169 m_readTimer.expires_from_now(boost::posix_time::seconds(
static_cast<uint32>(READ_TIMEOUT)));
186 m_readTimer.expires_from_now(boost::posix_time::seconds(
static_cast<uint32>(READ_TIMEOUT)));
201 m_readTimer.expires_from_now(boost::posix_time::seconds(
static_cast<uint32>(READ_TIMEOUT)));
205 void Connection::onResolve(
const boost::system::error_code& error, asio::ip::basic_resolver<asio::ip::tcp>::iterator endpointIterator)
209 if(error == asio::error::operation_aborted)
223 if(error == asio::error::operation_aborted)
230 boost::asio::ip::tcp::no_delay option(
true);
245 if(error == asio::error::operation_aborted)
252 void Connection::onWrite(
const boost::system::error_code& error,
size_t writeSize, std::shared_ptr<asio::streambuf> outputStream)
256 if(error == asio::error::operation_aborted)
260 outputStream->consume(outputStream->size());
272 if(error == asio::error::operation_aborted)
278 const char* header = boost::asio::buffer_cast<const char*>(
m_inputStream.data());
291 if(error == asio::error::operation_aborted)
299 if(error == asio::error::operation_aborted)
311 boost::system::error_code error;
312 const boost::asio::ip::tcp::endpoint ip =
m_socket.remote_endpoint(error);
314 return boost::asio::detail::socket_ops::host_to_network_long(ip.address().to_v4().to_ulong());