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

Function test

test/ip/udp.cpp:73–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71};
72
73void test()
74{
75 using namespace boost::asio;
76 namespace ip = boost::asio::ip;
77
78 try
79 {
80 io_context ioc;
81 const io_context::executor_type ioc_ex = ioc.get_executor();
82 char mutable_char_buffer[128] = "";
83 const char const_char_buffer[128] = "";
84 socket_base::message_flags in_flags = 0;
85 archetypes::settable_socket_option<void> settable_socket_option1;
86 archetypes::settable_socket_option<int> settable_socket_option2;
87 archetypes::settable_socket_option<double> settable_socket_option3;
88 archetypes::gettable_socket_option<void> gettable_socket_option1;
89 archetypes::gettable_socket_option<int> gettable_socket_option2;
90 archetypes::gettable_socket_option<double> gettable_socket_option3;
91 archetypes::io_control_command io_control_command;
92 archetypes::immediate_handler immediate;
93 archetypes::lazy_handler lazy;
94 boost::system::error_code ec;
95
96 // basic_datagram_socket constructors.
97
98 ip::udp::socket socket1(ioc);
99 ip::udp::socket socket2(ioc, ip::udp::v4());
100 ip::udp::socket socket3(ioc, ip::udp::v6());
101 ip::udp::socket socket4(ioc, ip::udp::endpoint(ip::udp::v4(), 0));
102 ip::udp::socket socket5(ioc, ip::udp::endpoint(ip::udp::v6(), 0));
103#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
104 ip::udp::socket::native_handle_type native_socket1
105 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
106 ip::udp::socket socket6(ioc, ip::udp::v4(), native_socket1);
107#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
108
109 ip::udp::socket socket7(ioc_ex);
110 ip::udp::socket socket8(ioc_ex, ip::udp::v4());
111 ip::udp::socket socket9(ioc_ex, ip::udp::v6());
112 ip::udp::socket socket10(ioc_ex, ip::udp::endpoint(ip::udp::v4(), 0));
113 ip::udp::socket socket11(ioc_ex, ip::udp::endpoint(ip::udp::v6(), 0));
114#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
115 ip::udp::socket::native_handle_type native_socket2
116 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
117 ip::udp::socket socket12(ioc_ex, ip::udp::v4(), native_socket2);
118#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
119
120 ip::udp::socket socket13(std::move(socket6));
121
122 // basic_datagram_socket operators.
123
124 socket1 = ip::udp::socket(ioc);
125 socket1 = std::move(socket2);
126
127 // I/O object functions.
128
129 ip::udp::socket::executor_type ex = socket1.get_executor();
130 (void)ex;

Callers

nothing calls this directly

Calls 15

bufferFunction · 0.85
connect_handlerClass · 0.70
wait_handlerClass · 0.70
send_handlerClass · 0.70
receive_handlerClass · 0.70
resolve_handlerClass · 0.70
endpointClass · 0.50
bindFunction · 0.50
flagsEnum · 0.50
get_executorMethod · 0.45
openMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected