now client_network_manager::receive() actually works
This commit is contained in:
parent
9c8f985210
commit
096d56d488
@ -37,8 +37,8 @@ namespace chat
|
|||||||
std::string receive_message_sync()
|
std::string receive_message_sync()
|
||||||
{
|
{
|
||||||
std::string data;
|
std::string data;
|
||||||
asio::read_until(_socket, _isb, static_cast<char>(message::TERM));
|
asio::read_until(_socket, _isb, byte(message::TERM));
|
||||||
std::getline(_is, data, static_cast<char>(message::TERM));
|
std::getline(_is, data, byte(message::TERM));
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -64,14 +64,18 @@ namespace chat
|
|||||||
|
|
||||||
void receive()
|
void receive()
|
||||||
{
|
{
|
||||||
asio::async_read(_socket, _isb,
|
asio::async_read_until(_socket, _isb, byte(message::TERM),
|
||||||
[this](boost::system::error_code ec, size_t)
|
[this](boost::system::error_code ec, size_t)
|
||||||
{
|
{
|
||||||
throw_if_error(ec);
|
throw_if_error(ec);
|
||||||
|
|
||||||
std::string data;
|
std::string data;
|
||||||
std::getline(_is, data, static_cast<char>(message::TERM));
|
std::getline(_is, data, byte(message::TERM));
|
||||||
std::cout << data << std::endl;
|
|
||||||
|
switch (data[0])
|
||||||
|
{
|
||||||
|
// TODO: handle stuff
|
||||||
|
}
|
||||||
|
|
||||||
receive();
|
receive();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user