Boost logo

Boost Users :

Subject: [Boost-users] [asio]: Having trouble getting started with ssl
From: Roland Bock (rbock_at_[hidden])
Date: 2008-12-28 15:33:23


Hi,

I tried to follow the documentation for ssl in boost::asio
(Overview/SSL), coming up with a few lines of code which fail to compile
with boost-1.36 (gcc-4.2.4, Ubuntu8.04, 64bit) with the following message:

sslTest.cpp:13: error: invalid initialization of reference of type
‘boost::asio::basic_stream_socket<boost::asio::ip::tcp,
boost::asio::stream_socket_service<boost::asio::ip::tcp> >&’ from
expression of type ‘boost::asio::basic_socket<boost::asio::ip::tcp,
boost::asio::stream_socket_service<boost::asio::ip::tcp> >’

The message is pretty clear, but I have no idea yet how to fix the problem.

Here is the code:

// -----------------------------------------
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>

using namespace std;
using namespace boost::asio;

int main()
{
    io_service ioService;
    ssl::context ctx(ioService, ssl::context::sslv23);
    ssl::stream<ip::tcp::socket> sslSock(ioService, ctx);

    ip::tcp::socket& sock = sslSock.lowest_layer();
}
// -----------------------------------------

Regards,

Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net