2 / Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 [section:SocketService Socket service requirements]
10 A socket service must meet the requirements for an [link
11 boost_asio.reference.IoObjectService I/O object service] with support for movability,
12 as well as the additional requirements listed below.
14 In the table below, `X` denotes a socket service class for protocol [link
15 boost_asio.reference.Protocol `Protocol`], `a` and `ao` denote values of type `X`,
16 `b` and `c` denote values of type `X::implementation_type`, `p` denotes a value
17 of type `Protocol`, `n` denotes a value of type `X::native_handle_type`, `e`
18 denotes a value of type `Protocol::endpoint`, `ec` denotes a value of type
19 `error_code`, `s` denotes a value meeting [link
20 boost_asio.reference.SettableSocketOption `SettableSocketOption`] requirements, `g`
21 denotes a value meeting [link boost_asio.reference.GettableSocketOption
22 `GettableSocketOption`] requirements, `i` denotes a value meeting [link
23 boost_asio.reference.IoControlCommand `IoControlCommand`] requirements, `h`
24 denotes a value of type `socket_base::shutdown_type`, `ch` denotes a value
25 meeting [link boost_asio.reference.ConnectHandler `ConnectHandler`]
26 requirements, and `u` and `v` denote identifiers.
28 [table SocketService requirements
29 [[expression] [return type] [assertion/note\npre/post-condition]]
31 [`X::native_handle_type`]
34 The implementation-defined native representation of a socket. Must
35 satisfy the requirements of `CopyConstructible` types (C++ Std, 20.1.3),
36 and the requirements of `Assignable` types (C++ Std, 23.1).
43 From [link boost_asio.reference.IoObjectService IoObjectService]
45 post: `!a.is_open(b)`.
52 From [link boost_asio.reference.IoObjectService IoObjectService]
53 requirements. Implicitly cancels asynchronous operations, as if by calling
59 a.move_construct(b, c);
63 From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
64 The underlying native representation is moved from `c` to `b`.
69 a.move_assign(b, ao, c);
73 From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
74 Implicitly cancels asynchronous operations associated with `b`, as if by
75 calling `a.close(b, ec)`. Then the underlying native representation is
76 moved from `c` to `b`.
85 pre: `!a.is_open(b)`.\n
86 post: `!!ec || a.is_open(b)`.
91 a.assign(b, p, n, ec);
95 pre: `!a.is_open(b)`.\n
96 post: `!!ec || a.is_open(b)`.
110 const X::implementation_type& v = b;
123 If `a.is_open()` is true, causes any outstanding asynchronous operations
124 to complete as soon as possible. Handlers for cancelled operations shall
125 be passed the error code `error::operation_aborted`.\n
126 post: `!a.is_open(b)`.
133 [`X::native_handle_type`]
143 pre: `a.is_open(b)`.\n
144 Causes any outstanding asynchronous operations to complete as soon as
145 possible. Handlers for cancelled operations shall be passed the error
146 code `error::operation_aborted`.
151 a.set_option(b, s, ec);
160 a.get_option(b, g, ec);
170 const X::implementation_type& v = b;
171 u.get_option(v, g, ec);
180 a.io_control(b, i, ec);
199 const X::implementation_type& v = b;
219 const X::implementation_type& v = b;
229 const typename Protocol::endpoint& u = e;
239 a.shutdown(b, h, ec);
248 a.local_endpoint(b, ec);
250 [`Protocol::endpoint`]
258 const X::implementation_type& v = b;
259 u.local_endpoint(v, ec);
261 [`Protocol::endpoint`]
268 a.remote_endpoint(b, ec);
270 [`Protocol::endpoint`]
278 const X::implementation_type& v = b;
279 u.remote_endpoint(v, ec);
281 [`Protocol::endpoint`]
288 const typename Protocol::endpoint& u = e;
298 const typename Protocol::endpoint& u = e;
299 a.async_connect(b, u, ch);
303 pre: `a.is_open(b)`.\n
304 Initiates an asynchronous connect operation that is performed via the
305 `io_service` object `a.get_io_service()` and behaves according to [link
306 boost_asio.reference.asynchronous_operations asynchronous operation]