add send() function to client
This commit is contained in:
13
src/main.cpp
13
src/main.cpp
@@ -16,7 +16,18 @@ void run_client() {
|
||||
spdlog::info("Running client...");
|
||||
commons::client s(io_context, boost::asio::ip::make_address("0.0.0.0"), 9000,
|
||||
0);
|
||||
s.init();
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
auto msg = std::make_shared<commons::protocol::draw_pixel>();
|
||||
msg->color = commons::protocol::vec3{i, i, i};
|
||||
|
||||
// used as lifetime expansion so that msg doesnt go out of scope till it
|
||||
// actually was sent
|
||||
s.send(msg->serialize(),
|
||||
std::bind(&commons::protocol::generic_message_base::handle_sent, msg,
|
||||
std::placeholders::_1));
|
||||
}
|
||||
|
||||
io_context.run();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user