Re: Hi all,

Pavel Vazharov via Boost-users <[email protected]> Wed, 6 Mar 2024 16:36:26 +0200
Newsgroups gmane.comp.lib.boost.user
Message-ID <CAK9EM1-XRLzBRLteQ4JpGtDqze9x7f3fGwOkJETqkngjfTWM3Q@mail.gmail.com>
Hi,

The most obvious error that I see is that you use `std::vector<char>
buffer_data(1024);`as local variables and then they are destroyed but you
continue to keep references to them via the boost::asio::buffer.
The latter will not keep the `std::vector`s alive.
You need to keep the std::vector as a member variable and only when you
call the asio functions use the `boost::asio::buffer` function.
Like
m_socketHandler->socket.async_read_some(boost::asio::buffer(m_buffer_data),
...

Where the m_buffer_data is a member variable of type `std::vector<char>`.

HTH,
Pavel.

_______________________________________________
Boost-users mailing list
[email protected]
https://lists.boost.org/mailman/listinfo.cgi/boost-users