MCPcopy Create free account
hub / github.com/boostorg/asio / handle_read

Method handle_read

example/cpp11/serialization/client.cpp:62–90  ·  view source on GitHub ↗

Handle completion of a read operation.

Source from the content-addressed store, hash-verified

60
61 /// Handle completion of a read operation.
62 void handle_read(const boost::system::error_code& e)
63 {
64 if (!e)
65 {
66 // Print out the data that was received.
67 for (std::size_t i = 0; i < stocks_.size(); ++i)
68 {
69 std::cout << "Stock number " << i << "\n";
70 std::cout << " code: " << stocks_[i].code << "\n";
71 std::cout << " name: " << stocks_[i].name << "\n";
72 std::cout << " open_price: " << stocks_[i].open_price << "\n";
73 std::cout << " high_price: " << stocks_[i].high_price << "\n";
74 std::cout << " low_price: " << stocks_[i].low_price << "\n";
75 std::cout << " last_price: " << stocks_[i].last_price << "\n";
76 std::cout << " buy_price: " << stocks_[i].buy_price << "\n";
77 std::cout << " buy_quantity: " << stocks_[i].buy_quantity << "\n";
78 std::cout << " sell_price: " << stocks_[i].sell_price << "\n";
79 std::cout << " sell_quantity: " << stocks_[i].sell_quantity << "\n";
80 }
81 }
82 else
83 {
84 // An error occurred.
85 std::cerr << e.message() << std::endl;
86 }
87
88 // Since we are not starting a new operation the io_context will run out of
89 // work to do and the client will exit.
90 }
91
92private:
93 /// The connection to the server.

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected