Boost logo

Boost :

Subject: Re: [boost] quest for member ‘read_some’ in ‘socket’, which is of non-class type ‘boost::asio::ip::tcp::socket* {aka boost::asio::basic_stream_socket<boost::asio::ip::tcp>*}
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-09-11 08:02:33


On 09/11/2012 08:18 AM, neha_mysql wrote:
> Hii,
>
> i am trying to execute a code and im getting error in this part of the
> code(in line no 3)
> for(;;)
> char buf[4];
> size_t len = socket.read_some(boost::asio::buffer(buf,4));
>
> if(error == boost::asio::error::eof)
> break;
> else if(error)
> throw boost::system::system_error(error);
>
> std::cout << "[!]";
> std::cout.write(buf.data(), len);
> }
>
> The error is *" quest for member ‘read_some’ in ‘socket’, which is of
> non-class type ‘boost::asio::ip::tcp::socket* {aka
> boost::asio::basic_stream_socket<boost::asio::ip::tcp>*}"*

That's more for boost-users than boost development mailing list.

As the error messages says, you're calling a member function on a
pointer. You need to use ->read_some not .read_some.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk