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

Method receive

example/cpp11/fork/daemon.cpp:32–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31private:
32 void receive()
33 {
34 socket_.async_receive_from(
35 boost::asio::buffer(recv_buffer_), remote_endpoint_,
36 [this](boost::system::error_code ec, std::size_t /*n*/)
37 {
38 if (!ec)
39 {
40 using namespace std; // For time_t, time and ctime;
41 time_t now = time(0);
42 std::string message = ctime(&now);
43
44 boost::system::error_code ignored_ec;
45 socket_.send_to(boost::asio::buffer(message),
46 remote_endpoint_, 0, ignored_ec);
47 }
48
49 receive();
50 });
51 }
52
53 udp::socket socket_;
54 udp::endpoint remote_endpoint_;

Callers 13

mainFunction · 0.45
testFunction · 0.45
mainFunction · 0.45
testFunction · 0.45
testFunction · 0.45
testFunction · 0.45
testFunction · 0.45
testFunction · 0.45
testFunction · 0.45
testFunction · 0.45
testFunction · 0.45
testFunction · 0.45

Calls 3

bufferFunction · 0.85
async_receive_fromMethod · 0.45
send_toMethod · 0.45

Tested by

no test coverage detected