You are not logged in.
I'm on boost version 1.72, the current version of boost on Arch. I have the following script:
int main(int argc, char *argv[])
{
boost::asio::io_service ioService;
boost::asio::ssl::context sslContext(boost::asio::ssl::context::sslv23);
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> sslSocket(ioService, sslContext);
sslSocket.set_verify_mode(boost::asio::ssl::verify_none);
boost::asio::ip::tcp::socket::lowest_layer_type &socket = sslSocket.lowest_layer();
// Resolve endpoint and connect successfully...
std::stringstream ss;
ss << "$ LOGIN " << username << " " << password;
const char *req = ss.str().c_str();
char data[500];
strcpy(data, req);
boost::asio::write(socket, boost::asio::buffer(data, sizeof(data)));
char buffer[1000];
boost::asio::read(socket, boost::asio::buffer(buffer));
std::string response = std::string(buffer);
std::cout << "Received response: " << response << std::endl;
return 0;
}
Now, when I compile this, I get the below errors:
/usr/bin/clang++ -I/ -pthread -std=gnu++17 -MD -MT CMakeFiles/app.dir/main.cpp.o -MF CMakeFiles/app.dir/main.cpp.o.d -o CMakeFiles/app.dir/main.cpp.o -c /src/main.cpp
In file included from /src/main.cpp:3:
In file included from /usr/include/boost/asio/write.hpp:1246:
/usr/include/boost/asio/impl/write.hpp:54:23: error: no member named 'write_some' in 'boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>'
tmp.consume(s.write_some(tmp.prepare(max_size), ec));
~ ^
/usr/include/boost/asio/impl/write.hpp:70:18: note: in instantiation of function template specialization 'boost::asio::detail::write_buffer_sequence<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::mutable_buffers_1, const boost::asio::mutable_buffer *, boost::asio::detail::transfer_all_t>' requested here
return detail::write_buffer_sequence(s, buffers,
^
/usr/include/boost/asio/impl/write.hpp:82:35: note: in instantiation of function template specialization 'boost::asio::write<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t>' requested here
std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec);
^
/src/main.cpp:59:18: note: in instantiation of function template specialization 'boost::asio::write<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::mutable_buffers_1>' requested here
boost::asio::write(socket, boost::asio::buffer(data, sizeof(data)));
^
In file included from /src/main.cpp:2:
In file included from /usr/include/boost/asio/read.hpp:1288:
/usr/include/boost/asio/impl/read.hpp:56:23: error: no member named 'read_some' in 'boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>'
tmp.consume(s.read_some(tmp.prepare(max_size), ec));
~ ^
/usr/include/boost/asio/impl/read.hpp:72:18: note: in instantiation of function template specialization 'boost::asio::detail::read_buffer_sequence<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::mutable_buffers_1, const boost::asio::mutable_buffer *, boost::asio::detail::transfer_all_t>' requested here
return detail::read_buffer_sequence(s, buffers,
^
/usr/include/boost/asio/impl/read.hpp:84:35: note: in instantiation of function template specialization 'boost::asio::read<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t>' requested here
std::size_t bytes_transferred = read(s, buffers, transfer_all(), ec);
^
/src/main.cpp:62:18: note: in instantiation of function template specialization 'boost::asio::read<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::executor>, boost::asio::mutable_buffers_1>' requested here
boost::asio::read(socket, boost::asio::buffer(buffer));
Seems to be some issue with the boost library itself? Anyone has any idea? Thanks.
Offline