Boost logo

Boost :

From: christopher baus (christopher_at_[hidden])
Date: 2005-12-11 13:49:16


I'm currently trying to port an app from libevent to asio to test out the
library. I have a quick question. Why doesn't the
basic_stream_socket::async_connect handler pass a pointer to the socket?
Is it assumed that the handler is a stateful functor and keeps a pointer
to the socket?

I wanted to do the following

void connect_handler(const boost::asio::error& error)

  if (!error)
    // Connect succeeded.
    // How do I get the connected socket here?
    // I want to call async_read_some like:
    // s->async_read_some(...);

int main()
  boost::asio::demuxer demuxer;

  boost::asio::stream_socket* socket = new

  boost::asio::ipv4::address addr("");
  socket->async_connect(boost::asio::ipv4::tcp::endpoint(80, addr),

Boost list run by bdawes at, gregod at, cpdaniel at, john at