2 / Copyright (c) 2003-2017 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:SocketAcceptorService Socket acceptor service requirements]
10 A socket acceptor service must meet the requirements for an [link
11 boost_asio.reference.IoObjectService I/O object service], as well as the
12 additional requirements listed below.
14 In the table below, `X` denotes a socket acceptor service class for protocol
15 [link boost_asio.reference.Protocol `Protocol`], `a` and `ao` denote values of type
16 `X`, `b` and `c` denote values of type `X::implementation_type`, `p` denotes a
17 value of type `Protocol`, `n` denotes a value of type `X::native_handle_type`,
18 `e` 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, `k` denotes a
24 value of type `basic_socket<Protocol, SocketService>` where `SocketService` is
25 a type meeting [link boost_asio.reference.SocketService socket service] requirements,
26 `ah` denotes a value meeting [link boost_asio.reference.AcceptHandler
27 `AcceptHandler`] requirements, and `u` and `v` denote identifiers.
29 [table SocketAcceptorService requirements
30 [[expression] [return type] [assertion/note\npre/post-condition]]
32 [`X::native_handle_type`]
35 The implementation-defined native representation of a socket acceptor.
36 Must satisfy the requirements of `CopyConstructible` types (C++ Std,
37 20.1.3), and the requirements of `Assignable` types (C++ Std, 23.1).
44 From [link boost_asio.reference.IoObjectService IoObjectService]
46 post: `!a.is_open(b)`.
53 From [link boost_asio.reference.IoObjectService IoObjectService]
54 requirements. Implicitly cancels asynchronous operations, as if by calling
60 a.move_construct(b, c);
64 From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
65 The underlying native representation is moved from `c` to `b`.
70 a.move_assign(b, ao, c);
74 From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
75 Implicitly cancels asynchronous operations associated with `b`, as if by
76 calling `a.close(b, ec)`. Then the underlying native representation is
77 moved from `c` to `b`.
86 pre: `!a.is_open(b)`.\n
87 post: `!!ec || a.is_open(b)`.
92 a.assign(b, p, n, ec);
96 pre: `!a.is_open(b)`.\n
97 post: `!!ec || a.is_open(b)`.
111 const X::implementation_type& v = b;
124 If `a.is_open()` is true, causes any outstanding asynchronous operations
125 to complete as soon as possible. Handlers for cancelled operations shall
126 be passed the error code `error::operation_aborted`.\n
127 post: `!a.is_open(b)`.
134 [`X::native_handle_type`]
144 pre: `a.is_open(b)`.\n
145 Causes any outstanding asynchronous operations to complete as soon as
146 possible. Handlers for cancelled operations shall be passed the error
147 code `error::operation_aborted`.
152 a.set_option(b, s, ec);
161 a.get_option(b, g, ec);
171 const X::implementation_type& v = b;
172 u.get_option(v, g, ec);
181 a.io_control(b, i, ec);
190 const typename Protocol::endpoint& u = e;
200 a.local_endpoint(b, ec);
202 [`Protocol::endpoint`]
210 const X::implementation_type& v = b;
211 u.local_endpoint(v, ec);
213 [`Protocol::endpoint`]
220 a.accept(b, k, &e, ec);
224 pre: `a.is_open(b) && !k.is_open()`.\n
230 a.accept(b, k, 0, ec);
234 pre: `a.is_open(b) && !k.is_open()`.\n
240 a.async_accept(b, k, &e, ah);
244 pre: `a.is_open(b) && !k.is_open()`.\n
245 Initiates an asynchronous accept operation that is performed via the
246 `io_service` object `a.get_io_service()` and behaves according to [link
247 boost_asio.reference.asynchronous_operations asynchronous operation]
249 The program must ensure the objects `k` and `e` are valid until the
250 handler for the asynchronous operation is invoked.
255 a.async_accept(b, k, 0, ah);
259 pre: `a.is_open(b) && !k.is_open()`.\n
260 Initiates an asynchronous accept operation that is performed via the
261 `io_service` object `a.get_io_service()` and behaves according to [link
262 boost_asio.reference.asynchronous_operations asynchronous operation]
264 The program must ensure the object `k` is valid until the handler for the
265 asynchronous operation is invoked.