Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit482fcf1

Browse files
committed
Updating documentation on server constructor options
Because of the Boost.Parameter refactoring to support moreoptions in the construction of the server instance, the documentationhad to be updated to cover all available options.
1 parentba96b4f commit482fcf1

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

‎boost/network/protocol/http/server.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ namespace boost { namespace network { namespace http {
8282
(send_buffer_size, (int))
8383
(receive_low_watermark, (int))
8484
(send_low_watermark, (int))
85-
(non_blocking_io, (int))
85+
(non_blocking_io, (bool))
8686
(linger, (bool))
8787
(linger_timeout, (int)))
8888
)

‎libs/network/doc/reference_http_server.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,70 @@ Constructor
172172
``std::string const &`` and handler being of type ``handler_type`` but
173173
passed in as an lvalue reference.
174174

175+
``template <class ArgPack> client(ArgPack const & args)``
176+
Pass in an argument pack. See supported parameters in the table below.
177+
178+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
179+
| Parameter Name| Type| Description|
180+
+========================+==========================================+==================================================================================================+
181+
| _address| string_type| The hostname or IP address from which the server should be bound to. This parameter is required.|
182+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
183+
| _port| string_type| The port to which the server should bind and listen to. This parameter is required.|
184+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
185+
| _handler| ``Handler &``| An lvalue reference to an instance of ``Handler``. This parameter is required.|
186+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
187+
| _thread_pool| ``boost::network::utils::thread_pool &``| An lvalue reference to an instance of ``boost::network::utils::thread_pool`` -- this is the|
188+
||| thread pool from where the handler is invoked. This parameter is only applicable and required|
189+
||| for ``async_server`` instances.|
190+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
191+
| _io_service| ``boost::asio::io_service &``| An optional lvalue to an instance of ``boost::asio::io_service`` which allows the server to use|
192+
||| an already-constructed ``boost::asio::io_service`` instance instead of instantiating one that it|
193+
||| manages.|
194+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
195+
| _reuse_address| ``bool``| A boolean that specifies whether to re-use the address and port on which the server will be|
196+
||| bound to. This enables or disables the socket option for listener sockets. The default is|
197+
||| ``false``.|
198+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
199+
| _report_aborted| ``bool``| A boolean that specifies whether the listening socket should report aborted connection attempts|
200+
||| to the accept handler (an internal detail of cpp-netlib). This is put in place to allow for|
201+
||| future-proofing the code in case an optional error handler function is supported in later|
202+
||| releases of cpp-netlib. The default is ``false``.|
203+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
204+
| _receive_buffer_size| ``int``| The size of the socket's receive buffer. The default is defined by Boost.Asio and is|
205+
||| platform-dependent.|
206+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
207+
| _send_buffer_size| ``int``| The size of the socket's send buffer. The default is defined by Boost.Asio and is|
208+
||| platform-dependent.|
209+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
210+
| _receive_low_watermark| ``int``| The size of the socket's low watermark for its receive buffer. The default is defined by|
211+
||| Boost.Asio and is platform-dependent.|
212+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
213+
| _send_buffer_size| ``int``| The size of the socket's send low watermark for its send buffer. The default is defined by|
214+
||| Boost.Asio and is platform-dependent.|
215+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
216+
| _non_blocking_io| ``bool``| An optional bool to define whether the socket should use non-blocking I/O in case the platform|
217+
||| supports it. The default is ``true``.|
218+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
219+
| _linger| ``bool``| An optional bool to determine whether the socket should linger in case there's still data to be|
220+
||| sent out at the time of its closing. The default is ``true``.|
221+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
222+
| _linger_timeout| ``int``| An optional int to define the timeout to wait for socket closes before it is set to linger.|
223+
||| The default is ``0``.|
224+
+------------------------+------------------------------------------+--------------------------------------------------------------------------------------------------+
225+
226+
To use the above supported named parameters, you'll have code that looks like the following:
227+
228+
..code-block::c++
229+
230+
using namespace boost::network::http; // parameters are in this namespace
231+
boost::asio::io_service my_io_service;
232+
boost::network::utils::thread_pool pool(2);
233+
handler handler_instance;
234+
async_server<handler> instance(_address="0.0.0.0", _port="80", _handler=handler_instance,
235+
_io_service=my_io_service, _thread_pool=pool,
236+
_reuse_address=true);
237+
instance.run();
238+
175239
Public Members
176240
``````````````
177241

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp