annotate DEPENDENCIES/generic/include/boost/asio/basic_raw_socket.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // basic_raw_socket.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@101 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_ASIO_BASIC_RAW_SOCKET_HPP
Chris@16 12 #define BOOST_ASIO_BASIC_RAW_SOCKET_HPP
Chris@16 13
Chris@16 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 15 # pragma once
Chris@16 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 17
Chris@16 18 #include <boost/asio/detail/config.hpp>
Chris@16 19 #include <cstddef>
Chris@16 20 #include <boost/asio/basic_socket.hpp>
Chris@16 21 #include <boost/asio/detail/handler_type_requirements.hpp>
Chris@16 22 #include <boost/asio/detail/throw_error.hpp>
Chris@16 23 #include <boost/asio/detail/type_traits.hpp>
Chris@16 24 #include <boost/asio/error.hpp>
Chris@16 25 #include <boost/asio/raw_socket_service.hpp>
Chris@16 26
Chris@16 27 #include <boost/asio/detail/push_options.hpp>
Chris@16 28
Chris@16 29 namespace boost {
Chris@16 30 namespace asio {
Chris@16 31
Chris@16 32 /// Provides raw-oriented socket functionality.
Chris@16 33 /**
Chris@16 34 * The basic_raw_socket class template provides asynchronous and blocking
Chris@16 35 * raw-oriented socket functionality.
Chris@16 36 *
Chris@16 37 * @par Thread Safety
Chris@16 38 * @e Distinct @e objects: Safe.@n
Chris@16 39 * @e Shared @e objects: Unsafe.
Chris@16 40 */
Chris@16 41 template <typename Protocol,
Chris@16 42 typename RawSocketService = raw_socket_service<Protocol> >
Chris@16 43 class basic_raw_socket
Chris@16 44 : public basic_socket<Protocol, RawSocketService>
Chris@16 45 {
Chris@16 46 public:
Chris@16 47 /// (Deprecated: Use native_handle_type.) The native representation of a
Chris@16 48 /// socket.
Chris@16 49 typedef typename RawSocketService::native_handle_type native_type;
Chris@16 50
Chris@16 51 /// The native representation of a socket.
Chris@16 52 typedef typename RawSocketService::native_handle_type native_handle_type;
Chris@16 53
Chris@16 54 /// The protocol type.
Chris@16 55 typedef Protocol protocol_type;
Chris@16 56
Chris@16 57 /// The endpoint type.
Chris@16 58 typedef typename Protocol::endpoint endpoint_type;
Chris@16 59
Chris@16 60 /// Construct a basic_raw_socket without opening it.
Chris@16 61 /**
Chris@16 62 * This constructor creates a raw socket without opening it. The open()
Chris@16 63 * function must be called before data can be sent or received on the socket.
Chris@16 64 *
Chris@16 65 * @param io_service The io_service object that the raw socket will use
Chris@16 66 * to dispatch handlers for any asynchronous operations performed on the
Chris@16 67 * socket.
Chris@16 68 */
Chris@16 69 explicit basic_raw_socket(boost::asio::io_service& io_service)
Chris@16 70 : basic_socket<Protocol, RawSocketService>(io_service)
Chris@16 71 {
Chris@16 72 }
Chris@16 73
Chris@16 74 /// Construct and open a basic_raw_socket.
Chris@16 75 /**
Chris@16 76 * This constructor creates and opens a raw socket.
Chris@16 77 *
Chris@16 78 * @param io_service The io_service object that the raw socket will use
Chris@16 79 * to dispatch handlers for any asynchronous operations performed on the
Chris@16 80 * socket.
Chris@16 81 *
Chris@16 82 * @param protocol An object specifying protocol parameters to be used.
Chris@16 83 *
Chris@16 84 * @throws boost::system::system_error Thrown on failure.
Chris@16 85 */
Chris@16 86 basic_raw_socket(boost::asio::io_service& io_service,
Chris@16 87 const protocol_type& protocol)
Chris@16 88 : basic_socket<Protocol, RawSocketService>(io_service, protocol)
Chris@16 89 {
Chris@16 90 }
Chris@16 91
Chris@16 92 /// Construct a basic_raw_socket, opening it and binding it to the given
Chris@16 93 /// local endpoint.
Chris@16 94 /**
Chris@16 95 * This constructor creates a raw socket and automatically opens it bound
Chris@16 96 * to the specified endpoint on the local machine. The protocol used is the
Chris@16 97 * protocol associated with the given endpoint.
Chris@16 98 *
Chris@16 99 * @param io_service The io_service object that the raw socket will use
Chris@16 100 * to dispatch handlers for any asynchronous operations performed on the
Chris@16 101 * socket.
Chris@16 102 *
Chris@16 103 * @param endpoint An endpoint on the local machine to which the raw
Chris@16 104 * socket will be bound.
Chris@16 105 *
Chris@16 106 * @throws boost::system::system_error Thrown on failure.
Chris@16 107 */
Chris@16 108 basic_raw_socket(boost::asio::io_service& io_service,
Chris@16 109 const endpoint_type& endpoint)
Chris@16 110 : basic_socket<Protocol, RawSocketService>(io_service, endpoint)
Chris@16 111 {
Chris@16 112 }
Chris@16 113
Chris@16 114 /// Construct a basic_raw_socket on an existing native socket.
Chris@16 115 /**
Chris@16 116 * This constructor creates a raw socket object to hold an existing
Chris@16 117 * native socket.
Chris@16 118 *
Chris@16 119 * @param io_service The io_service object that the raw socket will use
Chris@16 120 * to dispatch handlers for any asynchronous operations performed on the
Chris@16 121 * socket.
Chris@16 122 *
Chris@16 123 * @param protocol An object specifying protocol parameters to be used.
Chris@16 124 *
Chris@16 125 * @param native_socket The new underlying socket implementation.
Chris@16 126 *
Chris@16 127 * @throws boost::system::system_error Thrown on failure.
Chris@16 128 */
Chris@16 129 basic_raw_socket(boost::asio::io_service& io_service,
Chris@16 130 const protocol_type& protocol, const native_handle_type& native_socket)
Chris@16 131 : basic_socket<Protocol, RawSocketService>(
Chris@16 132 io_service, protocol, native_socket)
Chris@16 133 {
Chris@16 134 }
Chris@16 135
Chris@16 136 #if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
Chris@16 137 /// Move-construct a basic_raw_socket from another.
Chris@16 138 /**
Chris@16 139 * This constructor moves a raw socket from one object to another.
Chris@16 140 *
Chris@16 141 * @param other The other basic_raw_socket object from which the move
Chris@16 142 * will occur.
Chris@16 143 *
Chris@16 144 * @note Following the move, the moved-from object is in the same state as if
Chris@16 145 * constructed using the @c basic_raw_socket(io_service&) constructor.
Chris@16 146 */
Chris@16 147 basic_raw_socket(basic_raw_socket&& other)
Chris@16 148 : basic_socket<Protocol, RawSocketService>(
Chris@16 149 BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other))
Chris@16 150 {
Chris@16 151 }
Chris@16 152
Chris@16 153 /// Move-assign a basic_raw_socket from another.
Chris@16 154 /**
Chris@16 155 * This assignment operator moves a raw socket from one object to another.
Chris@16 156 *
Chris@16 157 * @param other The other basic_raw_socket object from which the move
Chris@16 158 * will occur.
Chris@16 159 *
Chris@16 160 * @note Following the move, the moved-from object is in the same state as if
Chris@16 161 * constructed using the @c basic_raw_socket(io_service&) constructor.
Chris@16 162 */
Chris@16 163 basic_raw_socket& operator=(basic_raw_socket&& other)
Chris@16 164 {
Chris@16 165 basic_socket<Protocol, RawSocketService>::operator=(
Chris@16 166 BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other));
Chris@16 167 return *this;
Chris@16 168 }
Chris@16 169
Chris@16 170 /// Move-construct a basic_raw_socket from a socket of another protocol type.
Chris@16 171 /**
Chris@16 172 * This constructor moves a raw socket from one object to another.
Chris@16 173 *
Chris@16 174 * @param other The other basic_raw_socket object from which the move will
Chris@16 175 * occur.
Chris@16 176 *
Chris@16 177 * @note Following the move, the moved-from object is in the same state as if
Chris@16 178 * constructed using the @c basic_raw_socket(io_service&) constructor.
Chris@16 179 */
Chris@16 180 template <typename Protocol1, typename RawSocketService1>
Chris@16 181 basic_raw_socket(basic_raw_socket<Protocol1, RawSocketService1>&& other,
Chris@16 182 typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0)
Chris@16 183 : basic_socket<Protocol, RawSocketService>(
Chris@16 184 BOOST_ASIO_MOVE_CAST2(basic_raw_socket<
Chris@16 185 Protocol1, RawSocketService1>)(other))
Chris@16 186 {
Chris@16 187 }
Chris@16 188
Chris@16 189 /// Move-assign a basic_raw_socket from a socket of another protocol type.
Chris@16 190 /**
Chris@16 191 * This assignment operator moves a raw socket from one object to another.
Chris@16 192 *
Chris@16 193 * @param other The other basic_raw_socket object from which the move
Chris@16 194 * will occur.
Chris@16 195 *
Chris@16 196 * @note Following the move, the moved-from object is in the same state as if
Chris@16 197 * constructed using the @c basic_raw_socket(io_service&) constructor.
Chris@16 198 */
Chris@16 199 template <typename Protocol1, typename RawSocketService1>
Chris@16 200 typename enable_if<is_convertible<Protocol1, Protocol>::value,
Chris@16 201 basic_raw_socket>::type& operator=(
Chris@16 202 basic_raw_socket<Protocol1, RawSocketService1>&& other)
Chris@16 203 {
Chris@16 204 basic_socket<Protocol, RawSocketService>::operator=(
Chris@16 205 BOOST_ASIO_MOVE_CAST2(basic_raw_socket<
Chris@16 206 Protocol1, RawSocketService1>)(other));
Chris@16 207 return *this;
Chris@16 208 }
Chris@16 209 #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
Chris@16 210
Chris@16 211 /// Send some data on a connected socket.
Chris@16 212 /**
Chris@16 213 * This function is used to send data on the raw socket. The function call
Chris@16 214 * will block until the data has been sent successfully or an error occurs.
Chris@16 215 *
Chris@16 216 * @param buffers One ore more data buffers to be sent on the socket.
Chris@16 217 *
Chris@16 218 * @returns The number of bytes sent.
Chris@16 219 *
Chris@16 220 * @throws boost::system::system_error Thrown on failure.
Chris@16 221 *
Chris@16 222 * @note The send operation can only be used with a connected socket. Use
Chris@16 223 * the send_to function to send data on an unconnected raw socket.
Chris@16 224 *
Chris@16 225 * @par Example
Chris@16 226 * To send a single data buffer use the @ref buffer function as follows:
Chris@16 227 * @code socket.send(boost::asio::buffer(data, size)); @endcode
Chris@16 228 * See the @ref buffer documentation for information on sending multiple
Chris@16 229 * buffers in one go, and how to use it with arrays, boost::array or
Chris@16 230 * std::vector.
Chris@16 231 */
Chris@16 232 template <typename ConstBufferSequence>
Chris@16 233 std::size_t send(const ConstBufferSequence& buffers)
Chris@16 234 {
Chris@16 235 boost::system::error_code ec;
Chris@16 236 std::size_t s = this->get_service().send(
Chris@16 237 this->get_implementation(), buffers, 0, ec);
Chris@16 238 boost::asio::detail::throw_error(ec, "send");
Chris@16 239 return s;
Chris@16 240 }
Chris@16 241
Chris@16 242 /// Send some data on a connected socket.
Chris@16 243 /**
Chris@16 244 * This function is used to send data on the raw socket. The function call
Chris@16 245 * will block until the data has been sent successfully or an error occurs.
Chris@16 246 *
Chris@16 247 * @param buffers One ore more data buffers to be sent on the socket.
Chris@16 248 *
Chris@16 249 * @param flags Flags specifying how the send call is to be made.
Chris@16 250 *
Chris@16 251 * @returns The number of bytes sent.
Chris@16 252 *
Chris@16 253 * @throws boost::system::system_error Thrown on failure.
Chris@16 254 *
Chris@16 255 * @note The send operation can only be used with a connected socket. Use
Chris@16 256 * the send_to function to send data on an unconnected raw socket.
Chris@16 257 */
Chris@16 258 template <typename ConstBufferSequence>
Chris@16 259 std::size_t send(const ConstBufferSequence& buffers,
Chris@16 260 socket_base::message_flags flags)
Chris@16 261 {
Chris@16 262 boost::system::error_code ec;
Chris@16 263 std::size_t s = this->get_service().send(
Chris@16 264 this->get_implementation(), buffers, flags, ec);
Chris@16 265 boost::asio::detail::throw_error(ec, "send");
Chris@16 266 return s;
Chris@16 267 }
Chris@16 268
Chris@16 269 /// Send some data on a connected socket.
Chris@16 270 /**
Chris@16 271 * This function is used to send data on the raw socket. The function call
Chris@16 272 * will block until the data has been sent successfully or an error occurs.
Chris@16 273 *
Chris@16 274 * @param buffers One or more data buffers to be sent on the socket.
Chris@16 275 *
Chris@16 276 * @param flags Flags specifying how the send call is to be made.
Chris@16 277 *
Chris@16 278 * @param ec Set to indicate what error occurred, if any.
Chris@16 279 *
Chris@16 280 * @returns The number of bytes sent.
Chris@16 281 *
Chris@16 282 * @note The send operation can only be used with a connected socket. Use
Chris@16 283 * the send_to function to send data on an unconnected raw socket.
Chris@16 284 */
Chris@16 285 template <typename ConstBufferSequence>
Chris@16 286 std::size_t send(const ConstBufferSequence& buffers,
Chris@16 287 socket_base::message_flags flags, boost::system::error_code& ec)
Chris@16 288 {
Chris@16 289 return this->get_service().send(
Chris@16 290 this->get_implementation(), buffers, flags, ec);
Chris@16 291 }
Chris@16 292
Chris@16 293 /// Start an asynchronous send on a connected socket.
Chris@16 294 /**
Chris@16 295 * This function is used to send data on the raw socket. The function call
Chris@16 296 * will block until the data has been sent successfully or an error occurs.
Chris@16 297 *
Chris@16 298 * @param buffers One or more data buffers to be sent on the socket. Although
Chris@16 299 * the buffers object may be copied as necessary, ownership of the underlying
Chris@16 300 * memory blocks is retained by the caller, which must guarantee that they
Chris@16 301 * remain valid until the handler is called.
Chris@16 302 *
Chris@16 303 * @param handler The handler to be called when the send operation completes.
Chris@16 304 * Copies will be made of the handler as required. The function signature of
Chris@16 305 * the handler must be:
Chris@16 306 * @code void handler(
Chris@16 307 * const boost::system::error_code& error, // Result of operation.
Chris@16 308 * std::size_t bytes_transferred // Number of bytes sent.
Chris@16 309 * ); @endcode
Chris@16 310 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 311 * not, the handler will not be invoked from within this function. Invocation
Chris@16 312 * of the handler will be performed in a manner equivalent to using
Chris@16 313 * boost::asio::io_service::post().
Chris@16 314 *
Chris@16 315 * @note The async_send operation can only be used with a connected socket.
Chris@16 316 * Use the async_send_to function to send data on an unconnected raw
Chris@16 317 * socket.
Chris@16 318 *
Chris@16 319 * @par Example
Chris@16 320 * To send a single data buffer use the @ref buffer function as follows:
Chris@16 321 * @code
Chris@16 322 * socket.async_send(boost::asio::buffer(data, size), handler);
Chris@16 323 * @endcode
Chris@16 324 * See the @ref buffer documentation for information on sending multiple
Chris@16 325 * buffers in one go, and how to use it with arrays, boost::array or
Chris@16 326 * std::vector.
Chris@16 327 */
Chris@16 328 template <typename ConstBufferSequence, typename WriteHandler>
Chris@16 329 BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
Chris@16 330 void (boost::system::error_code, std::size_t))
Chris@16 331 async_send(const ConstBufferSequence& buffers,
Chris@16 332 BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
Chris@16 333 {
Chris@16 334 // If you get an error on the following line it means that your handler does
Chris@16 335 // not meet the documented type requirements for a WriteHandler.
Chris@16 336 BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
Chris@16 337
Chris@16 338 return this->get_service().async_send(this->get_implementation(),
Chris@16 339 buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
Chris@16 340 }
Chris@16 341
Chris@16 342 /// Start an asynchronous send on a connected socket.
Chris@16 343 /**
Chris@16 344 * This function is used to send data on the raw socket. The function call
Chris@16 345 * will block until the data has been sent successfully or an error occurs.
Chris@16 346 *
Chris@16 347 * @param buffers One or more data buffers to be sent on the socket. Although
Chris@16 348 * the buffers object may be copied as necessary, ownership of the underlying
Chris@16 349 * memory blocks is retained by the caller, which must guarantee that they
Chris@16 350 * remain valid until the handler is called.
Chris@16 351 *
Chris@16 352 * @param flags Flags specifying how the send call is to be made.
Chris@16 353 *
Chris@16 354 * @param handler The handler to be called when the send operation completes.
Chris@16 355 * Copies will be made of the handler as required. The function signature of
Chris@16 356 * the handler must be:
Chris@16 357 * @code void handler(
Chris@16 358 * const boost::system::error_code& error, // Result of operation.
Chris@16 359 * std::size_t bytes_transferred // Number of bytes sent.
Chris@16 360 * ); @endcode
Chris@16 361 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 362 * not, the handler will not be invoked from within this function. Invocation
Chris@16 363 * of the handler will be performed in a manner equivalent to using
Chris@16 364 * boost::asio::io_service::post().
Chris@16 365 *
Chris@16 366 * @note The async_send operation can only be used with a connected socket.
Chris@16 367 * Use the async_send_to function to send data on an unconnected raw
Chris@16 368 * socket.
Chris@16 369 */
Chris@16 370 template <typename ConstBufferSequence, typename WriteHandler>
Chris@16 371 BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
Chris@16 372 void (boost::system::error_code, std::size_t))
Chris@16 373 async_send(const ConstBufferSequence& buffers,
Chris@16 374 socket_base::message_flags flags,
Chris@16 375 BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
Chris@16 376 {
Chris@16 377 // If you get an error on the following line it means that your handler does
Chris@16 378 // not meet the documented type requirements for a WriteHandler.
Chris@16 379 BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
Chris@16 380
Chris@16 381 return this->get_service().async_send(this->get_implementation(),
Chris@16 382 buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
Chris@16 383 }
Chris@16 384
Chris@16 385 /// Send raw data to the specified endpoint.
Chris@16 386 /**
Chris@16 387 * This function is used to send raw data to the specified remote endpoint.
Chris@16 388 * The function call will block until the data has been sent successfully or
Chris@16 389 * an error occurs.
Chris@16 390 *
Chris@16 391 * @param buffers One or more data buffers to be sent to the remote endpoint.
Chris@16 392 *
Chris@16 393 * @param destination The remote endpoint to which the data will be sent.
Chris@16 394 *
Chris@16 395 * @returns The number of bytes sent.
Chris@16 396 *
Chris@16 397 * @throws boost::system::system_error Thrown on failure.
Chris@16 398 *
Chris@16 399 * @par Example
Chris@16 400 * To send a single data buffer use the @ref buffer function as follows:
Chris@16 401 * @code
Chris@16 402 * boost::asio::ip::udp::endpoint destination(
Chris@16 403 * boost::asio::ip::address::from_string("1.2.3.4"), 12345);
Chris@16 404 * socket.send_to(boost::asio::buffer(data, size), destination);
Chris@16 405 * @endcode
Chris@16 406 * See the @ref buffer documentation for information on sending multiple
Chris@16 407 * buffers in one go, and how to use it with arrays, boost::array or
Chris@16 408 * std::vector.
Chris@16 409 */
Chris@16 410 template <typename ConstBufferSequence>
Chris@16 411 std::size_t send_to(const ConstBufferSequence& buffers,
Chris@16 412 const endpoint_type& destination)
Chris@16 413 {
Chris@16 414 boost::system::error_code ec;
Chris@16 415 std::size_t s = this->get_service().send_to(
Chris@16 416 this->get_implementation(), buffers, destination, 0, ec);
Chris@16 417 boost::asio::detail::throw_error(ec, "send_to");
Chris@16 418 return s;
Chris@16 419 }
Chris@16 420
Chris@16 421 /// Send raw data to the specified endpoint.
Chris@16 422 /**
Chris@16 423 * This function is used to send raw data to the specified remote endpoint.
Chris@16 424 * The function call will block until the data has been sent successfully or
Chris@16 425 * an error occurs.
Chris@16 426 *
Chris@16 427 * @param buffers One or more data buffers to be sent to the remote endpoint.
Chris@16 428 *
Chris@16 429 * @param destination The remote endpoint to which the data will be sent.
Chris@16 430 *
Chris@16 431 * @param flags Flags specifying how the send call is to be made.
Chris@16 432 *
Chris@16 433 * @returns The number of bytes sent.
Chris@16 434 *
Chris@16 435 * @throws boost::system::system_error Thrown on failure.
Chris@16 436 */
Chris@16 437 template <typename ConstBufferSequence>
Chris@16 438 std::size_t send_to(const ConstBufferSequence& buffers,
Chris@16 439 const endpoint_type& destination, socket_base::message_flags flags)
Chris@16 440 {
Chris@16 441 boost::system::error_code ec;
Chris@16 442 std::size_t s = this->get_service().send_to(
Chris@16 443 this->get_implementation(), buffers, destination, flags, ec);
Chris@16 444 boost::asio::detail::throw_error(ec, "send_to");
Chris@16 445 return s;
Chris@16 446 }
Chris@16 447
Chris@16 448 /// Send raw data to the specified endpoint.
Chris@16 449 /**
Chris@16 450 * This function is used to send raw data to the specified remote endpoint.
Chris@16 451 * The function call will block until the data has been sent successfully or
Chris@16 452 * an error occurs.
Chris@16 453 *
Chris@16 454 * @param buffers One or more data buffers to be sent to the remote endpoint.
Chris@16 455 *
Chris@16 456 * @param destination The remote endpoint to which the data will be sent.
Chris@16 457 *
Chris@16 458 * @param flags Flags specifying how the send call is to be made.
Chris@16 459 *
Chris@16 460 * @param ec Set to indicate what error occurred, if any.
Chris@16 461 *
Chris@16 462 * @returns The number of bytes sent.
Chris@16 463 */
Chris@16 464 template <typename ConstBufferSequence>
Chris@16 465 std::size_t send_to(const ConstBufferSequence& buffers,
Chris@16 466 const endpoint_type& destination, socket_base::message_flags flags,
Chris@16 467 boost::system::error_code& ec)
Chris@16 468 {
Chris@16 469 return this->get_service().send_to(this->get_implementation(),
Chris@16 470 buffers, destination, flags, ec);
Chris@16 471 }
Chris@16 472
Chris@16 473 /// Start an asynchronous send.
Chris@16 474 /**
Chris@16 475 * This function is used to asynchronously send raw data to the specified
Chris@16 476 * remote endpoint. The function call always returns immediately.
Chris@16 477 *
Chris@16 478 * @param buffers One or more data buffers to be sent to the remote endpoint.
Chris@16 479 * Although the buffers object may be copied as necessary, ownership of the
Chris@16 480 * underlying memory blocks is retained by the caller, which must guarantee
Chris@16 481 * that they remain valid until the handler is called.
Chris@16 482 *
Chris@16 483 * @param destination The remote endpoint to which the data will be sent.
Chris@16 484 * Copies will be made of the endpoint as required.
Chris@16 485 *
Chris@16 486 * @param handler The handler to be called when the send operation completes.
Chris@16 487 * Copies will be made of the handler as required. The function signature of
Chris@16 488 * the handler must be:
Chris@16 489 * @code void handler(
Chris@16 490 * const boost::system::error_code& error, // Result of operation.
Chris@16 491 * std::size_t bytes_transferred // Number of bytes sent.
Chris@16 492 * ); @endcode
Chris@16 493 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 494 * not, the handler will not be invoked from within this function. Invocation
Chris@16 495 * of the handler will be performed in a manner equivalent to using
Chris@16 496 * boost::asio::io_service::post().
Chris@16 497 *
Chris@16 498 * @par Example
Chris@16 499 * To send a single data buffer use the @ref buffer function as follows:
Chris@16 500 * @code
Chris@16 501 * boost::asio::ip::udp::endpoint destination(
Chris@16 502 * boost::asio::ip::address::from_string("1.2.3.4"), 12345);
Chris@16 503 * socket.async_send_to(
Chris@16 504 * boost::asio::buffer(data, size), destination, handler);
Chris@16 505 * @endcode
Chris@16 506 * See the @ref buffer documentation for information on sending multiple
Chris@16 507 * buffers in one go, and how to use it with arrays, boost::array or
Chris@16 508 * std::vector.
Chris@16 509 */
Chris@16 510 template <typename ConstBufferSequence, typename WriteHandler>
Chris@16 511 BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
Chris@16 512 void (boost::system::error_code, std::size_t))
Chris@16 513 async_send_to(const ConstBufferSequence& buffers,
Chris@16 514 const endpoint_type& destination,
Chris@16 515 BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
Chris@16 516 {
Chris@16 517 // If you get an error on the following line it means that your handler does
Chris@16 518 // not meet the documented type requirements for a WriteHandler.
Chris@16 519 BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
Chris@16 520
Chris@16 521 return this->get_service().async_send_to(this->get_implementation(),
Chris@16 522 buffers, destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
Chris@16 523 }
Chris@16 524
Chris@16 525 /// Start an asynchronous send.
Chris@16 526 /**
Chris@16 527 * This function is used to asynchronously send raw data to the specified
Chris@16 528 * remote endpoint. The function call always returns immediately.
Chris@16 529 *
Chris@16 530 * @param buffers One or more data buffers to be sent to the remote endpoint.
Chris@16 531 * Although the buffers object may be copied as necessary, ownership of the
Chris@16 532 * underlying memory blocks is retained by the caller, which must guarantee
Chris@16 533 * that they remain valid until the handler is called.
Chris@16 534 *
Chris@16 535 * @param flags Flags specifying how the send call is to be made.
Chris@16 536 *
Chris@16 537 * @param destination The remote endpoint to which the data will be sent.
Chris@16 538 * Copies will be made of the endpoint as required.
Chris@16 539 *
Chris@16 540 * @param handler The handler to be called when the send operation completes.
Chris@16 541 * Copies will be made of the handler as required. The function signature of
Chris@16 542 * the handler must be:
Chris@16 543 * @code void handler(
Chris@16 544 * const boost::system::error_code& error, // Result of operation.
Chris@16 545 * std::size_t bytes_transferred // Number of bytes sent.
Chris@16 546 * ); @endcode
Chris@16 547 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 548 * not, the handler will not be invoked from within this function. Invocation
Chris@16 549 * of the handler will be performed in a manner equivalent to using
Chris@16 550 * boost::asio::io_service::post().
Chris@16 551 */
Chris@16 552 template <typename ConstBufferSequence, typename WriteHandler>
Chris@16 553 BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
Chris@16 554 void (boost::system::error_code, std::size_t))
Chris@16 555 async_send_to(const ConstBufferSequence& buffers,
Chris@16 556 const endpoint_type& destination, socket_base::message_flags flags,
Chris@16 557 BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
Chris@16 558 {
Chris@16 559 // If you get an error on the following line it means that your handler does
Chris@16 560 // not meet the documented type requirements for a WriteHandler.
Chris@16 561 BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
Chris@16 562
Chris@16 563 return this->get_service().async_send_to(
Chris@16 564 this->get_implementation(), buffers, destination, flags,
Chris@16 565 BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
Chris@16 566 }
Chris@16 567
Chris@16 568 /// Receive some data on a connected socket.
Chris@16 569 /**
Chris@16 570 * This function is used to receive data on the raw socket. The function
Chris@16 571 * call will block until data has been received successfully or an error
Chris@16 572 * occurs.
Chris@16 573 *
Chris@16 574 * @param buffers One or more buffers into which the data will be received.
Chris@16 575 *
Chris@16 576 * @returns The number of bytes received.
Chris@16 577 *
Chris@16 578 * @throws boost::system::system_error Thrown on failure.
Chris@16 579 *
Chris@16 580 * @note The receive operation can only be used with a connected socket. Use
Chris@16 581 * the receive_from function to receive data on an unconnected raw
Chris@16 582 * socket.
Chris@16 583 *
Chris@16 584 * @par Example
Chris@16 585 * To receive into a single data buffer use the @ref buffer function as
Chris@16 586 * follows:
Chris@16 587 * @code socket.receive(boost::asio::buffer(data, size)); @endcode
Chris@16 588 * See the @ref buffer documentation for information on receiving into
Chris@16 589 * multiple buffers in one go, and how to use it with arrays, boost::array or
Chris@16 590 * std::vector.
Chris@16 591 */
Chris@16 592 template <typename MutableBufferSequence>
Chris@16 593 std::size_t receive(const MutableBufferSequence& buffers)
Chris@16 594 {
Chris@16 595 boost::system::error_code ec;
Chris@16 596 std::size_t s = this->get_service().receive(
Chris@16 597 this->get_implementation(), buffers, 0, ec);
Chris@16 598 boost::asio::detail::throw_error(ec, "receive");
Chris@16 599 return s;
Chris@16 600 }
Chris@16 601
Chris@16 602 /// Receive some data on a connected socket.
Chris@16 603 /**
Chris@16 604 * This function is used to receive data on the raw socket. The function
Chris@16 605 * call will block until data has been received successfully or an error
Chris@16 606 * occurs.
Chris@16 607 *
Chris@16 608 * @param buffers One or more buffers into which the data will be received.
Chris@16 609 *
Chris@16 610 * @param flags Flags specifying how the receive call is to be made.
Chris@16 611 *
Chris@16 612 * @returns The number of bytes received.
Chris@16 613 *
Chris@16 614 * @throws boost::system::system_error Thrown on failure.
Chris@16 615 *
Chris@16 616 * @note The receive operation can only be used with a connected socket. Use
Chris@16 617 * the receive_from function to receive data on an unconnected raw
Chris@16 618 * socket.
Chris@16 619 */
Chris@16 620 template <typename MutableBufferSequence>
Chris@16 621 std::size_t receive(const MutableBufferSequence& buffers,
Chris@16 622 socket_base::message_flags flags)
Chris@16 623 {
Chris@16 624 boost::system::error_code ec;
Chris@16 625 std::size_t s = this->get_service().receive(
Chris@16 626 this->get_implementation(), buffers, flags, ec);
Chris@16 627 boost::asio::detail::throw_error(ec, "receive");
Chris@16 628 return s;
Chris@16 629 }
Chris@16 630
Chris@16 631 /// Receive some data on a connected socket.
Chris@16 632 /**
Chris@16 633 * This function is used to receive data on the raw socket. The function
Chris@16 634 * call will block until data has been received successfully or an error
Chris@16 635 * occurs.
Chris@16 636 *
Chris@16 637 * @param buffers One or more buffers into which the data will be received.
Chris@16 638 *
Chris@16 639 * @param flags Flags specifying how the receive call is to be made.
Chris@16 640 *
Chris@16 641 * @param ec Set to indicate what error occurred, if any.
Chris@16 642 *
Chris@16 643 * @returns The number of bytes received.
Chris@16 644 *
Chris@16 645 * @note The receive operation can only be used with a connected socket. Use
Chris@16 646 * the receive_from function to receive data on an unconnected raw
Chris@16 647 * socket.
Chris@16 648 */
Chris@16 649 template <typename MutableBufferSequence>
Chris@16 650 std::size_t receive(const MutableBufferSequence& buffers,
Chris@16 651 socket_base::message_flags flags, boost::system::error_code& ec)
Chris@16 652 {
Chris@16 653 return this->get_service().receive(
Chris@16 654 this->get_implementation(), buffers, flags, ec);
Chris@16 655 }
Chris@16 656
Chris@16 657 /// Start an asynchronous receive on a connected socket.
Chris@16 658 /**
Chris@16 659 * This function is used to asynchronously receive data from the raw
Chris@16 660 * socket. The function call always returns immediately.
Chris@16 661 *
Chris@16 662 * @param buffers One or more buffers into which the data will be received.
Chris@16 663 * Although the buffers object may be copied as necessary, ownership of the
Chris@16 664 * underlying memory blocks is retained by the caller, which must guarantee
Chris@16 665 * that they remain valid until the handler is called.
Chris@16 666 *
Chris@16 667 * @param handler The handler to be called when the receive operation
Chris@16 668 * completes. Copies will be made of the handler as required. The function
Chris@16 669 * signature of the handler must be:
Chris@16 670 * @code void handler(
Chris@16 671 * const boost::system::error_code& error, // Result of operation.
Chris@16 672 * std::size_t bytes_transferred // Number of bytes received.
Chris@16 673 * ); @endcode
Chris@16 674 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 675 * not, the handler will not be invoked from within this function. Invocation
Chris@16 676 * of the handler will be performed in a manner equivalent to using
Chris@16 677 * boost::asio::io_service::post().
Chris@16 678 *
Chris@16 679 * @note The async_receive operation can only be used with a connected socket.
Chris@16 680 * Use the async_receive_from function to receive data on an unconnected
Chris@16 681 * raw socket.
Chris@16 682 *
Chris@16 683 * @par Example
Chris@16 684 * To receive into a single data buffer use the @ref buffer function as
Chris@16 685 * follows:
Chris@16 686 * @code
Chris@16 687 * socket.async_receive(boost::asio::buffer(data, size), handler);
Chris@16 688 * @endcode
Chris@16 689 * See the @ref buffer documentation for information on receiving into
Chris@16 690 * multiple buffers in one go, and how to use it with arrays, boost::array or
Chris@16 691 * std::vector.
Chris@16 692 */
Chris@16 693 template <typename MutableBufferSequence, typename ReadHandler>
Chris@16 694 BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
Chris@16 695 void (boost::system::error_code, std::size_t))
Chris@16 696 async_receive(const MutableBufferSequence& buffers,
Chris@16 697 BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
Chris@16 698 {
Chris@16 699 // If you get an error on the following line it means that your handler does
Chris@16 700 // not meet the documented type requirements for a ReadHandler.
Chris@16 701 BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
Chris@16 702
Chris@16 703 return this->get_service().async_receive(this->get_implementation(),
Chris@16 704 buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
Chris@16 705 }
Chris@16 706
Chris@16 707 /// Start an asynchronous receive on a connected socket.
Chris@16 708 /**
Chris@16 709 * This function is used to asynchronously receive data from the raw
Chris@16 710 * socket. The function call always returns immediately.
Chris@16 711 *
Chris@16 712 * @param buffers One or more buffers into which the data will be received.
Chris@16 713 * Although the buffers object may be copied as necessary, ownership of the
Chris@16 714 * underlying memory blocks is retained by the caller, which must guarantee
Chris@16 715 * that they remain valid until the handler is called.
Chris@16 716 *
Chris@16 717 * @param flags Flags specifying how the receive call is to be made.
Chris@16 718 *
Chris@16 719 * @param handler The handler to be called when the receive operation
Chris@16 720 * completes. Copies will be made of the handler as required. The function
Chris@16 721 * signature of the handler must be:
Chris@16 722 * @code void handler(
Chris@16 723 * const boost::system::error_code& error, // Result of operation.
Chris@16 724 * std::size_t bytes_transferred // Number of bytes received.
Chris@16 725 * ); @endcode
Chris@16 726 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 727 * not, the handler will not be invoked from within this function. Invocation
Chris@16 728 * of the handler will be performed in a manner equivalent to using
Chris@16 729 * boost::asio::io_service::post().
Chris@16 730 *
Chris@16 731 * @note The async_receive operation can only be used with a connected socket.
Chris@16 732 * Use the async_receive_from function to receive data on an unconnected
Chris@16 733 * raw socket.
Chris@16 734 */
Chris@16 735 template <typename MutableBufferSequence, typename ReadHandler>
Chris@16 736 BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
Chris@16 737 void (boost::system::error_code, std::size_t))
Chris@16 738 async_receive(const MutableBufferSequence& buffers,
Chris@16 739 socket_base::message_flags flags,
Chris@16 740 BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
Chris@16 741 {
Chris@16 742 // If you get an error on the following line it means that your handler does
Chris@16 743 // not meet the documented type requirements for a ReadHandler.
Chris@16 744 BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
Chris@16 745
Chris@16 746 return this->get_service().async_receive(this->get_implementation(),
Chris@16 747 buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
Chris@16 748 }
Chris@16 749
Chris@16 750 /// Receive raw data with the endpoint of the sender.
Chris@16 751 /**
Chris@16 752 * This function is used to receive raw data. The function call will block
Chris@16 753 * until data has been received successfully or an error occurs.
Chris@16 754 *
Chris@16 755 * @param buffers One or more buffers into which the data will be received.
Chris@16 756 *
Chris@16 757 * @param sender_endpoint An endpoint object that receives the endpoint of
Chris@16 758 * the remote sender of the data.
Chris@16 759 *
Chris@16 760 * @returns The number of bytes received.
Chris@16 761 *
Chris@16 762 * @throws boost::system::system_error Thrown on failure.
Chris@16 763 *
Chris@16 764 * @par Example
Chris@16 765 * To receive into a single data buffer use the @ref buffer function as
Chris@16 766 * follows:
Chris@16 767 * @code
Chris@16 768 * boost::asio::ip::udp::endpoint sender_endpoint;
Chris@16 769 * socket.receive_from(
Chris@16 770 * boost::asio::buffer(data, size), sender_endpoint);
Chris@16 771 * @endcode
Chris@16 772 * See the @ref buffer documentation for information on receiving into
Chris@16 773 * multiple buffers in one go, and how to use it with arrays, boost::array or
Chris@16 774 * std::vector.
Chris@16 775 */
Chris@16 776 template <typename MutableBufferSequence>
Chris@16 777 std::size_t receive_from(const MutableBufferSequence& buffers,
Chris@16 778 endpoint_type& sender_endpoint)
Chris@16 779 {
Chris@16 780 boost::system::error_code ec;
Chris@16 781 std::size_t s = this->get_service().receive_from(
Chris@16 782 this->get_implementation(), buffers, sender_endpoint, 0, ec);
Chris@16 783 boost::asio::detail::throw_error(ec, "receive_from");
Chris@16 784 return s;
Chris@16 785 }
Chris@16 786
Chris@16 787 /// Receive raw data with the endpoint of the sender.
Chris@16 788 /**
Chris@16 789 * This function is used to receive raw data. The function call will block
Chris@16 790 * until data has been received successfully or an error occurs.
Chris@16 791 *
Chris@16 792 * @param buffers One or more buffers into which the data will be received.
Chris@16 793 *
Chris@16 794 * @param sender_endpoint An endpoint object that receives the endpoint of
Chris@16 795 * the remote sender of the data.
Chris@16 796 *
Chris@16 797 * @param flags Flags specifying how the receive call is to be made.
Chris@16 798 *
Chris@16 799 * @returns The number of bytes received.
Chris@16 800 *
Chris@16 801 * @throws boost::system::system_error Thrown on failure.
Chris@16 802 */
Chris@16 803 template <typename MutableBufferSequence>
Chris@16 804 std::size_t receive_from(const MutableBufferSequence& buffers,
Chris@16 805 endpoint_type& sender_endpoint, socket_base::message_flags flags)
Chris@16 806 {
Chris@16 807 boost::system::error_code ec;
Chris@16 808 std::size_t s = this->get_service().receive_from(
Chris@16 809 this->get_implementation(), buffers, sender_endpoint, flags, ec);
Chris@16 810 boost::asio::detail::throw_error(ec, "receive_from");
Chris@16 811 return s;
Chris@16 812 }
Chris@16 813
Chris@16 814 /// Receive raw data with the endpoint of the sender.
Chris@16 815 /**
Chris@16 816 * This function is used to receive raw data. The function call will block
Chris@16 817 * until data has been received successfully or an error occurs.
Chris@16 818 *
Chris@16 819 * @param buffers One or more buffers into which the data will be received.
Chris@16 820 *
Chris@16 821 * @param sender_endpoint An endpoint object that receives the endpoint of
Chris@16 822 * the remote sender of the data.
Chris@16 823 *
Chris@16 824 * @param flags Flags specifying how the receive call is to be made.
Chris@16 825 *
Chris@16 826 * @param ec Set to indicate what error occurred, if any.
Chris@16 827 *
Chris@16 828 * @returns The number of bytes received.
Chris@16 829 */
Chris@16 830 template <typename MutableBufferSequence>
Chris@16 831 std::size_t receive_from(const MutableBufferSequence& buffers,
Chris@16 832 endpoint_type& sender_endpoint, socket_base::message_flags flags,
Chris@16 833 boost::system::error_code& ec)
Chris@16 834 {
Chris@16 835 return this->get_service().receive_from(this->get_implementation(),
Chris@16 836 buffers, sender_endpoint, flags, ec);
Chris@16 837 }
Chris@16 838
Chris@16 839 /// Start an asynchronous receive.
Chris@16 840 /**
Chris@16 841 * This function is used to asynchronously receive raw data. The function
Chris@16 842 * call always returns immediately.
Chris@16 843 *
Chris@16 844 * @param buffers One or more buffers into which the data will be received.
Chris@16 845 * Although the buffers object may be copied as necessary, ownership of the
Chris@16 846 * underlying memory blocks is retained by the caller, which must guarantee
Chris@16 847 * that they remain valid until the handler is called.
Chris@16 848 *
Chris@16 849 * @param sender_endpoint An endpoint object that receives the endpoint of
Chris@16 850 * the remote sender of the data. Ownership of the sender_endpoint object
Chris@16 851 * is retained by the caller, which must guarantee that it is valid until the
Chris@16 852 * handler is called.
Chris@16 853 *
Chris@16 854 * @param handler The handler to be called when the receive operation
Chris@16 855 * completes. Copies will be made of the handler as required. The function
Chris@16 856 * signature of the handler must be:
Chris@16 857 * @code void handler(
Chris@16 858 * const boost::system::error_code& error, // Result of operation.
Chris@16 859 * std::size_t bytes_transferred // Number of bytes received.
Chris@16 860 * ); @endcode
Chris@16 861 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 862 * not, the handler will not be invoked from within this function. Invocation
Chris@16 863 * of the handler will be performed in a manner equivalent to using
Chris@16 864 * boost::asio::io_service::post().
Chris@16 865 *
Chris@16 866 * @par Example
Chris@16 867 * To receive into a single data buffer use the @ref buffer function as
Chris@16 868 * follows:
Chris@16 869 * @code socket.async_receive_from(
Chris@16 870 * boost::asio::buffer(data, size), 0, sender_endpoint, handler); @endcode
Chris@16 871 * See the @ref buffer documentation for information on receiving into
Chris@16 872 * multiple buffers in one go, and how to use it with arrays, boost::array or
Chris@16 873 * std::vector.
Chris@16 874 */
Chris@16 875 template <typename MutableBufferSequence, typename ReadHandler>
Chris@16 876 BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
Chris@16 877 void (boost::system::error_code, std::size_t))
Chris@16 878 async_receive_from(const MutableBufferSequence& buffers,
Chris@16 879 endpoint_type& sender_endpoint,
Chris@16 880 BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
Chris@16 881 {
Chris@16 882 // If you get an error on the following line it means that your handler does
Chris@16 883 // not meet the documented type requirements for a ReadHandler.
Chris@16 884 BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
Chris@16 885
Chris@16 886 return this->get_service().async_receive_from(
Chris@16 887 this->get_implementation(), buffers, sender_endpoint, 0,
Chris@16 888 BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
Chris@16 889 }
Chris@16 890
Chris@16 891 /// Start an asynchronous receive.
Chris@16 892 /**
Chris@16 893 * This function is used to asynchronously receive raw data. The function
Chris@16 894 * call always returns immediately.
Chris@16 895 *
Chris@16 896 * @param buffers One or more buffers into which the data will be received.
Chris@16 897 * Although the buffers object may be copied as necessary, ownership of the
Chris@16 898 * underlying memory blocks is retained by the caller, which must guarantee
Chris@16 899 * that they remain valid until the handler is called.
Chris@16 900 *
Chris@16 901 * @param sender_endpoint An endpoint object that receives the endpoint of
Chris@16 902 * the remote sender of the data. Ownership of the sender_endpoint object
Chris@16 903 * is retained by the caller, which must guarantee that it is valid until the
Chris@16 904 * handler is called.
Chris@16 905 *
Chris@16 906 * @param flags Flags specifying how the receive call is to be made.
Chris@16 907 *
Chris@16 908 * @param handler The handler to be called when the receive operation
Chris@16 909 * completes. Copies will be made of the handler as required. The function
Chris@16 910 * signature of the handler must be:
Chris@16 911 * @code void handler(
Chris@16 912 * const boost::system::error_code& error, // Result of operation.
Chris@16 913 * std::size_t bytes_transferred // Number of bytes received.
Chris@16 914 * ); @endcode
Chris@16 915 * Regardless of whether the asynchronous operation completes immediately or
Chris@16 916 * not, the handler will not be invoked from within this function. Invocation
Chris@16 917 * of the handler will be performed in a manner equivalent to using
Chris@16 918 * boost::asio::io_service::post().
Chris@16 919 */
Chris@16 920 template <typename MutableBufferSequence, typename ReadHandler>
Chris@16 921 BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
Chris@16 922 void (boost::system::error_code, std::size_t))
Chris@16 923 async_receive_from(const MutableBufferSequence& buffers,
Chris@16 924 endpoint_type& sender_endpoint, socket_base::message_flags flags,
Chris@16 925 BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
Chris@16 926 {
Chris@16 927 // If you get an error on the following line it means that your handler does
Chris@16 928 // not meet the documented type requirements for a ReadHandler.
Chris@16 929 BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
Chris@16 930
Chris@16 931 return this->get_service().async_receive_from(
Chris@16 932 this->get_implementation(), buffers, sender_endpoint, flags,
Chris@16 933 BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
Chris@16 934 }
Chris@16 935 };
Chris@16 936
Chris@16 937 } // namespace asio
Chris@16 938 } // namespace boost
Chris@16 939
Chris@16 940 #include <boost/asio/detail/pop_options.hpp>
Chris@16 941
Chris@16 942 #endif // BOOST_ASIO_BASIC_RAW_SOCKET_HPP