#include #include #include /* clang++ -std=c++11 -stdlib=libc++ testasiossl.cpp -I /opt/local/include -lssl -lcrypto -L/opt/local/lib -lboost_system-mt g++-mp-4.7 -std=c++11 testasiossl.cpp -I /opt/local/include -lssl -lcrypto -L/opt/local/lib -lboost_system-mt */ class teststream { boost::asio::io_service &io; public: teststream(boost::asio::io_service &io_service) : io(io_service) { } template void async_read_some(boost::asio::mutable_buffers_1, ReadHandler handler) { } template void async_write_some(boost::asio::const_buffers_1 bufs, WriteHandler handler) { } typedef teststream lowest_layer_type; lowest_layer_type& lowest_layer() { return *this; } boost::asio::io_service &get_io_service() { return io; } }; int main(int, char**) { boost::asio::io_service io_service; typedef boost::asio::ssl::stream ssl_socket; boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23); ssl_socket sock(io_service, ctx); sock.set_verify_mode(boost::asio::ssl::verify_none); sock.async_handshake(ssl_socket::client, [&sock](const boost::system::error_code& error) { boost::asio::async_write(sock, boost::asio::buffer("test123", 7), [](const boost::system::error_code& error, std::size_t n) { std::cout << "xmitted " << n << " bytes\n"; }); uint8_t *rcv= new uint8_t[16]; boost::asio::async_read(sock, boost::asio::buffer(rcv, 16), [rcv](const boost::system::error_code& error, std::size_t n) { std::cout << "received " << n << " bytes\n"; }); }); }