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

Function test

test/local/stream_protocol.cpp:53–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void test()
54{
55#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
56 using namespace boost::asio;
57 namespace local = boost::asio::local;
58 typedef local::stream_protocol sp;
59
60 try
61 {
62 io_context ioc;
63 const io_context::executor_type ioc_ex = ioc.get_executor();
64 char mutable_char_buffer[128] = "";
65 const char const_char_buffer[128] = "";
66 socket_base::message_flags in_flags = 0;
67 socket_base::keep_alive socket_option;
68 socket_base::bytes_readable io_control_command;
69 boost::system::error_code ec;
70
71 // basic_stream_socket constructors.
72
73 sp::socket socket1(ioc);
74 sp::socket socket2(ioc, sp());
75 sp::socket socket3(ioc, sp::endpoint(""));
76 int native_socket1 = ::socket(AF_UNIX, SOCK_STREAM, 0);
77 sp::socket socket4(ioc, sp(), native_socket1);
78
79 sp::socket socket5(ioc_ex);
80 sp::socket socket6(ioc_ex, sp());
81 sp::socket socket7(ioc_ex, sp::endpoint(""));
82 int native_socket2 = ::socket(AF_UNIX, SOCK_STREAM, 0);
83 sp::socket socket8(ioc_ex, sp(), native_socket2);
84
85 // I/O object functions.
86
87 sp::socket::executor_type ex = socket1.get_executor();
88 (void)ex;
89
90 // basic_socket functions.
91
92 sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
93 (void)lowest_layer;
94
95 socket1.open(sp());
96 socket1.open(sp(), ec);
97
98 int native_socket3 = ::socket(AF_UNIX, SOCK_STREAM, 0);
99 socket1.assign(sp(), native_socket3);
100 int native_socket4 = ::socket(AF_UNIX, SOCK_STREAM, 0);
101 socket1.assign(sp(), native_socket4, ec);
102
103 bool is_open = socket1.is_open();
104 (void)is_open;
105
106 socket1.close();
107 socket1.close(ec);
108
109 sp::socket::native_handle_type native_socket5 = socket1.native_handle();
110 (void)native_socket5;

Callers

nothing calls this directly

Calls 15

bufferFunction · 0.85
endpointClass · 0.50
get_executorMethod · 0.45
openMethod · 0.45
assignMethod · 0.45
is_openMethod · 0.45
closeMethod · 0.45
native_handleMethod · 0.45
cancelMethod · 0.45
at_markMethod · 0.45
availableMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected