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

Function test

test/socket_base.cpp:33–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31namespace socket_base_compile {
32
33void test()
34{
35 using namespace boost::asio;
36 namespace ip = boost::asio::ip;
37
38 try
39 {
40 io_context ioc;
41 ip::tcp::socket sock(ioc);
42 char buf[1024];
43
44 // shutdown_type enumeration.
45
46 sock.shutdown(socket_base::shutdown_receive);
47 sock.shutdown(socket_base::shutdown_send);
48 sock.shutdown(socket_base::shutdown_both);
49
50 // message_flags constants.
51
52 sock.receive(buffer(buf), socket_base::message_peek);
53 sock.receive(buffer(buf), socket_base::message_out_of_band);
54 sock.send(buffer(buf), socket_base::message_do_not_route);
55
56 // broadcast class.
57
58 socket_base::broadcast broadcast1(true);
59 sock.set_option(broadcast1);
60 socket_base::broadcast broadcast2;
61 sock.get_option(broadcast2);
62 broadcast1 = true;
63 (void)static_cast<bool>(broadcast1);
64 (void)static_cast<bool>(!broadcast1);
65 (void)static_cast<bool>(broadcast1.value());
66
67 // debug class.
68
69 socket_base::debug debug1(true);
70 sock.set_option(debug1);
71 socket_base::debug debug2;
72 sock.get_option(debug2);
73 debug1 = true;
74 (void)static_cast<bool>(debug1);
75 (void)static_cast<bool>(!debug1);
76 (void)static_cast<bool>(debug1.value());
77
78 // do_not_route class.
79
80 socket_base::do_not_route do_not_route1(true);
81 sock.set_option(do_not_route1);
82 socket_base::do_not_route do_not_route2;
83 sock.get_option(do_not_route2);
84 do_not_route1 = true;
85 (void)static_cast<bool>(do_not_route1);
86 (void)static_cast<bool>(!do_not_route1);
87 (void)static_cast<bool>(do_not_route1.value());
88
89 // keep_alive class.
90

Callers

nothing calls this directly

Calls 11

bufferFunction · 0.85
timeoutMethod · 0.80
shutdownMethod · 0.45
receiveMethod · 0.45
sendMethod · 0.45
set_optionMethod · 0.45
get_optionMethod · 0.45
valueMethod · 0.45
enabledMethod · 0.45
io_controlMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected