本文整理汇总了C++中connection::pointer类的典型用法代码示例。如果您正苦于以下问题:C++ pointer类的具体用法?C++ pointer怎么用?C++ pointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pointer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listen
void Server::listen()
{
Connection::pointer connection = Connection::create(*this);
m_acceptor.async_accept(connection->socket(),
boost::bind(&Server::accept, this, connection,
ba::placeholders::error));
}
示例2: accept
void Server::accept(Connection::pointer connection, const boost::system::error_code& error)
{
std::string ip = connection->socket().remote_endpoint().address().to_v4().to_string();
std::cout << "-----------------------------------------\n";
std::cout << "New request coming from " << ip << std::endl;
if (!error)
connection->start();
else
std::cout << "Server accept error : " << error.message() << std::endl;
listen();
}
示例3: operator
void operator()(connection::pointer ptr)
{
std::cout << "Request handler" << std::endl;
std::ostringstream oss;
oss << ptr->get_request_url() << '\n';
for (connection::headers_type::const_iterator it = ptr->get_headers().begin(), end = ptr->get_headers().end();
it != end; ++it)
{
oss << "[" << it->first << "]=[" << it->second << "]" << std::endl;
}
ptr->send_response(200, oss.str());
}
示例4: handle_accept
/**
* Run when new connection is accepted
*
* @param new_connection accepted connection
* @param error reference to error object
*/
void handle_accept(connection::pointer new_connection,
const boost::system::error_code& error) {
if (!error) {
new_connection->start();
start_accept();
}
}
示例5: handle_accept
void server::handle_accept(connection::pointer new_connection, const bs::error_code& error) {
// std::cout << "server::handle_accept" << std::endl;
if (!error) {
new_connection->start();
start_accept();
}
}
示例6: handle_accept
void handle_accept(connection::pointer new_connection,
const asio::error_code& error)
{
if (!error)
{
new_connection->start();
}
start_accept();
}
示例7: main
int main()
{
DBus::init();
Connection::pointer connection = DBus::Connection::create( DBus::BUS_SESSION );
SignalMessage::pointer message;
message = SignalMessage::create( "/test/signal/Object", // object name of the signal
"test.signal.Type", // interface name of the signal
"Test" ); // name of the signal
const char* sigvalue1 = "Hello World";
// append arguments onto signal
message << sigvalue1;
// send the message and flush the connection
connection << message;
connection->flush();
usleep(250000);
}
示例8: handle_accept
void NetworkRecorder::handle_accept(Connection::pointer new_connection,
const boost::system::error_code& error)
{
if (!error)
{
{
OpenCVImage image;
{
boost::mutex::scoped_lock lock(m_lock);
image.copyFrom(m_buffer);
image.setSize(160, 120);
}
new_connection->sendImage(&image);
}
start_accept();
}
}