Clementine
basic_datagram_socket.hpp
1 //
2 // basic_datagram_socket.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_BASIC_DATAGRAM_SOCKET_HPP
12 #define ASIO_BASIC_DATAGRAM_SOCKET_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include <cstddef>
20 #include "asio/basic_socket.hpp"
21 #include "asio/detail/handler_type_requirements.hpp"
22 #include "asio/detail/non_const_lvalue.hpp"
23 #include "asio/detail/throw_error.hpp"
24 #include "asio/detail/type_traits.hpp"
25 #include "asio/error.hpp"
26 
27 #include "asio/detail/push_options.hpp"
28 
29 namespace asio {
30 
31 #if !defined(ASIO_BASIC_DATAGRAM_SOCKET_FWD_DECL)
32 #define ASIO_BASIC_DATAGRAM_SOCKET_FWD_DECL
33 
34 // Forward declaration with defaulted arguments.
35 template <typename Protocol, typename Executor = any_io_executor>
37 
38 #endif // !defined(ASIO_BASIC_DATAGRAM_SOCKET_FWD_DECL)
39 
41 
49 template <typename Protocol, typename Executor>
51  : public basic_socket<Protocol, Executor>
52 {
53 public:
55  typedef Executor executor_type;
56 
58  template <typename Executor1>
60  {
63  };
64 
66 #if defined(GENERATING_DOCUMENTATION)
67  typedef implementation_defined native_handle_type;
68 #else
69  typedef typename basic_socket<Protocol,
71 #endif
72 
74  typedef Protocol protocol_type;
75 
77  typedef typename Protocol::endpoint endpoint_type;
78 
80 
87  explicit basic_datagram_socket(const executor_type& ex)
88  : basic_socket<Protocol, Executor>(ex)
89  {
90  }
91 
93 
101  template <typename ExecutionContext>
102  explicit basic_datagram_socket(ExecutionContext& context,
103  typename enable_if<
104  is_convertible<ExecutionContext&, execution_context&>::value
105  >::type* = 0)
106  : basic_socket<Protocol, Executor>(context)
107  {
108  }
109 
111 
121  basic_datagram_socket(const executor_type& ex, const protocol_type& protocol)
122  : basic_socket<Protocol, Executor>(ex, protocol)
123  {
124  }
125 
127 
138  template <typename ExecutionContext>
139  basic_datagram_socket(ExecutionContext& context,
140  const protocol_type& protocol,
141  typename enable_if<
142  is_convertible<ExecutionContext&, execution_context&>::value
143  >::type* = 0)
144  : basic_socket<Protocol, Executor>(context, protocol)
145  {
146  }
147 
150 
163  basic_datagram_socket(const executor_type& ex, const endpoint_type& endpoint)
164  : basic_socket<Protocol, Executor>(ex, endpoint)
165  {
166  }
167 
170 
184  template <typename ExecutionContext>
185  basic_datagram_socket(ExecutionContext& context,
186  const endpoint_type& endpoint,
187  typename enable_if<
188  is_convertible<ExecutionContext&, execution_context&>::value
189  >::type* = 0)
190  : basic_socket<Protocol, Executor>(context, endpoint)
191  {
192  }
193 
195 
208  basic_datagram_socket(const executor_type& ex,
209  const protocol_type& protocol, const native_handle_type& native_socket)
210  : basic_socket<Protocol, Executor>(ex, protocol, native_socket)
211  {
212  }
213 
215 
229  template <typename ExecutionContext>
230  basic_datagram_socket(ExecutionContext& context,
231  const protocol_type& protocol, const native_handle_type& native_socket,
232  typename enable_if<
233  is_convertible<ExecutionContext&, execution_context&>::value
234  >::type* = 0)
235  : basic_socket<Protocol, Executor>(context, protocol, native_socket)
236  {
237  }
238 
239 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
240 
253  {
254  }
255 
257 
269  {
271  return *this;
272  }
273 
276 
286  template <typename Protocol1, typename Executor1>
288  typename enable_if<
289  is_convertible<Protocol1, Protocol>::value
290  && is_convertible<Executor1, Executor>::value
291  >::type* = 0)
293  {
294  }
295 
298 
309  template <typename Protocol1, typename Executor1>
310  typename enable_if<
311  is_convertible<Protocol1, Protocol>::value
312  && is_convertible<Executor1, Executor>::value,
315  {
317  return *this;
318  }
319 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
320 
322 
327  {
328  }
329 
331 
352  template <typename ConstBufferSequence>
353  std::size_t send(const ConstBufferSequence& buffers)
354  {
355  asio::error_code ec;
356  std::size_t s = this->impl_.get_service().send(
357  this->impl_.get_implementation(), buffers, 0, ec);
358  asio::detail::throw_error(ec, "send");
359  return s;
360  }
361 
363 
379  template <typename ConstBufferSequence>
380  std::size_t send(const ConstBufferSequence& buffers,
382  {
383  asio::error_code ec;
384  std::size_t s = this->impl_.get_service().send(
385  this->impl_.get_implementation(), buffers, flags, ec);
386  asio::detail::throw_error(ec, "send");
387  return s;
388  }
389 
391 
407  template <typename ConstBufferSequence>
408  std::size_t send(const ConstBufferSequence& buffers,
410  {
411  return this->impl_.get_service().send(
412  this->impl_.get_implementation(), buffers, flags, ec);
413  }
414 
416 
450  template <typename ConstBufferSequence,
451  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
452  std::size_t)) WriteHandler
453  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
454  ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
455  void (asio::error_code, std::size_t))
456  async_send(const ConstBufferSequence& buffers,
457  ASIO_MOVE_ARG(WriteHandler) handler
458  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
459  {
460  return async_initiate<WriteHandler,
461  void (asio::error_code, std::size_t)>(
462  initiate_async_send(this), handler,
463  buffers, socket_base::message_flags(0));
464  }
465 
467 
494  template <typename ConstBufferSequence,
495  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
496  std::size_t)) WriteHandler
497  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
498  ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
499  void (asio::error_code, std::size_t))
500  async_send(const ConstBufferSequence& buffers,
502  ASIO_MOVE_ARG(WriteHandler) handler
503  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
504  {
505  return async_initiate<WriteHandler,
506  void (asio::error_code, std::size_t)>(
507  initiate_async_send(this), handler, buffers, flags);
508  }
509 
511 
535  template <typename ConstBufferSequence>
536  std::size_t send_to(const ConstBufferSequence& buffers,
537  const endpoint_type& destination)
538  {
539  asio::error_code ec;
540  std::size_t s = this->impl_.get_service().send_to(
541  this->impl_.get_implementation(), buffers, destination, 0, ec);
542  asio::detail::throw_error(ec, "send_to");
543  return s;
544  }
545 
547 
562  template <typename ConstBufferSequence>
563  std::size_t send_to(const ConstBufferSequence& buffers,
564  const endpoint_type& destination, socket_base::message_flags flags)
565  {
566  asio::error_code ec;
567  std::size_t s = this->impl_.get_service().send_to(
568  this->impl_.get_implementation(), buffers, destination, flags, ec);
569  asio::detail::throw_error(ec, "send_to");
570  return s;
571  }
572 
574 
589  template <typename ConstBufferSequence>
590  std::size_t send_to(const ConstBufferSequence& buffers,
591  const endpoint_type& destination, socket_base::message_flags flags,
592  asio::error_code& ec)
593  {
594  return this->impl_.get_service().send_to(this->impl_.get_implementation(),
595  buffers, destination, flags, ec);
596  }
597 
599 
635  template <typename ConstBufferSequence,
636  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
637  std::size_t)) WriteHandler
638  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
639  ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
640  void (asio::error_code, std::size_t))
641  async_send_to(const ConstBufferSequence& buffers,
642  const endpoint_type& destination,
643  ASIO_MOVE_ARG(WriteHandler) handler
644  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
645  {
646  return async_initiate<WriteHandler,
647  void (asio::error_code, std::size_t)>(
648  initiate_async_send_to(this), handler, buffers,
649  destination, socket_base::message_flags(0));
650  }
651 
653 
679  template <typename ConstBufferSequence,
680  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
681  std::size_t)) WriteHandler
682  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
683  ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
684  void (asio::error_code, std::size_t))
685  async_send_to(const ConstBufferSequence& buffers,
686  const endpoint_type& destination, socket_base::message_flags flags,
687  ASIO_MOVE_ARG(WriteHandler) handler
688  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
689  {
690  return async_initiate<WriteHandler,
691  void (asio::error_code, std::size_t)>(
692  initiate_async_send_to(this), handler, buffers, destination, flags);
693  }
694 
696 
719  template <typename MutableBufferSequence>
720  std::size_t receive(const MutableBufferSequence& buffers)
721  {
722  asio::error_code ec;
723  std::size_t s = this->impl_.get_service().receive(
724  this->impl_.get_implementation(), buffers, 0, ec);
725  asio::detail::throw_error(ec, "receive");
726  return s;
727  }
728 
730 
747  template <typename MutableBufferSequence>
748  std::size_t receive(const MutableBufferSequence& buffers,
750  {
751  asio::error_code ec;
752  std::size_t s = this->impl_.get_service().receive(
753  this->impl_.get_implementation(), buffers, flags, ec);
754  asio::detail::throw_error(ec, "receive");
755  return s;
756  }
757 
759 
776  template <typename MutableBufferSequence>
777  std::size_t receive(const MutableBufferSequence& buffers,
779  {
780  return this->impl_.get_service().receive(
781  this->impl_.get_implementation(), buffers, flags, ec);
782  }
783 
785 
820  template <typename MutableBufferSequence,
821  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
822  std::size_t)) ReadHandler
823  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
824  ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
825  void (asio::error_code, std::size_t))
826  async_receive(const MutableBufferSequence& buffers,
827  ASIO_MOVE_ARG(ReadHandler) handler
828  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
829  {
830  return async_initiate<ReadHandler,
831  void (asio::error_code, std::size_t)>(
832  initiate_async_receive(this), handler,
833  buffers, socket_base::message_flags(0));
834  }
835 
837 
864  template <typename MutableBufferSequence,
865  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
866  std::size_t)) ReadHandler
867  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
868  ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
869  void (asio::error_code, std::size_t))
870  async_receive(const MutableBufferSequence& buffers,
872  ASIO_MOVE_ARG(ReadHandler) handler
873  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
874  {
875  return async_initiate<ReadHandler,
876  void (asio::error_code, std::size_t)>(
877  initiate_async_receive(this), handler, buffers, flags);
878  }
879 
881 
906  template <typename MutableBufferSequence>
907  std::size_t receive_from(const MutableBufferSequence& buffers,
908  endpoint_type& sender_endpoint)
909  {
910  asio::error_code ec;
911  std::size_t s = this->impl_.get_service().receive_from(
912  this->impl_.get_implementation(), buffers, sender_endpoint, 0, ec);
913  asio::detail::throw_error(ec, "receive_from");
914  return s;
915  }
916 
918 
933  template <typename MutableBufferSequence>
934  std::size_t receive_from(const MutableBufferSequence& buffers,
935  endpoint_type& sender_endpoint, socket_base::message_flags flags)
936  {
937  asio::error_code ec;
938  std::size_t s = this->impl_.get_service().receive_from(
939  this->impl_.get_implementation(), buffers, sender_endpoint, flags, ec);
940  asio::detail::throw_error(ec, "receive_from");
941  return s;
942  }
943 
945 
960  template <typename MutableBufferSequence>
961  std::size_t receive_from(const MutableBufferSequence& buffers,
962  endpoint_type& sender_endpoint, socket_base::message_flags flags,
963  asio::error_code& ec)
964  {
965  return this->impl_.get_service().receive_from(
966  this->impl_.get_implementation(), buffers, sender_endpoint, flags, ec);
967  }
968 
970 
1005  template <typename MutableBufferSequence,
1006  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
1007  std::size_t)) ReadHandler
1008  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1009  ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
1010  void (asio::error_code, std::size_t))
1011  async_receive_from(const MutableBufferSequence& buffers,
1012  endpoint_type& sender_endpoint,
1013  ASIO_MOVE_ARG(ReadHandler) handler
1014  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
1015  {
1016  return async_initiate<ReadHandler,
1017  void (asio::error_code, std::size_t)>(
1018  initiate_async_receive_from(this), handler, buffers,
1019  &sender_endpoint, socket_base::message_flags(0));
1020  }
1021 
1023 
1051  template <typename MutableBufferSequence,
1052  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
1053  std::size_t)) ReadHandler
1054  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1055  ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
1056  void (asio::error_code, std::size_t))
1057  async_receive_from(const MutableBufferSequence& buffers,
1058  endpoint_type& sender_endpoint, socket_base::message_flags flags,
1059  ASIO_MOVE_ARG(ReadHandler) handler
1060  ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
1061  {
1062  return async_initiate<ReadHandler,
1063  void (asio::error_code, std::size_t)>(
1064  initiate_async_receive_from(this), handler,
1065  buffers, &sender_endpoint, flags);
1066  }
1067 
1068 private:
1069  // Disallow copying and assignment.
1070  basic_datagram_socket(const basic_datagram_socket&) ASIO_DELETED;
1071  basic_datagram_socket& operator=(
1072  const basic_datagram_socket&) ASIO_DELETED;
1073 
1074  class initiate_async_send
1075  {
1076  public:
1077  typedef Executor executor_type;
1078 
1079  explicit initiate_async_send(basic_datagram_socket* self)
1080  : self_(self)
1081  {
1082  }
1083 
1084  executor_type get_executor() const ASIO_NOEXCEPT
1085  {
1086  return self_->get_executor();
1087  }
1088 
1089  template <typename WriteHandler, typename ConstBufferSequence>
1090  void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
1091  const ConstBufferSequence& buffers,
1092  socket_base::message_flags flags) const
1093  {
1094  // If you get an error on the following line it means that your handler
1095  // does not meet the documented type requirements for a WriteHandler.
1096  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
1097 
1098  detail::non_const_lvalue<WriteHandler> handler2(handler);
1099  self_->impl_.get_service().async_send(
1100  self_->impl_.get_implementation(), buffers, flags,
1101  handler2.value, self_->impl_.get_executor());
1102  }
1103 
1104  private:
1105  basic_datagram_socket* self_;
1106  };
1107 
1108  class initiate_async_send_to
1109  {
1110  public:
1111  typedef Executor executor_type;
1112 
1113  explicit initiate_async_send_to(basic_datagram_socket* self)
1114  : self_(self)
1115  {
1116  }
1117 
1118  executor_type get_executor() const ASIO_NOEXCEPT
1119  {
1120  return self_->get_executor();
1121  }
1122 
1123  template <typename WriteHandler, typename ConstBufferSequence>
1124  void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
1125  const ConstBufferSequence& buffers, const endpoint_type& destination,
1126  socket_base::message_flags flags) const
1127  {
1128  // If you get an error on the following line it means that your handler
1129  // does not meet the documented type requirements for a WriteHandler.
1130  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
1131 
1132  detail::non_const_lvalue<WriteHandler> handler2(handler);
1133  self_->impl_.get_service().async_send_to(
1134  self_->impl_.get_implementation(), buffers, destination,
1135  flags, handler2.value, self_->impl_.get_executor());
1136  }
1137 
1138  private:
1139  basic_datagram_socket* self_;
1140  };
1141 
1142  class initiate_async_receive
1143  {
1144  public:
1145  typedef Executor executor_type;
1146 
1147  explicit initiate_async_receive(basic_datagram_socket* self)
1148  : self_(self)
1149  {
1150  }
1151 
1152  executor_type get_executor() const ASIO_NOEXCEPT
1153  {
1154  return self_->get_executor();
1155  }
1156 
1157  template <typename ReadHandler, typename MutableBufferSequence>
1158  void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
1159  const MutableBufferSequence& buffers,
1160  socket_base::message_flags flags) const
1161  {
1162  // If you get an error on the following line it means that your handler
1163  // does not meet the documented type requirements for a ReadHandler.
1164  ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
1165 
1166  detail::non_const_lvalue<ReadHandler> handler2(handler);
1167  self_->impl_.get_service().async_receive(
1168  self_->impl_.get_implementation(), buffers, flags,
1169  handler2.value, self_->impl_.get_executor());
1170  }
1171 
1172  private:
1173  basic_datagram_socket* self_;
1174  };
1175 
1176  class initiate_async_receive_from
1177  {
1178  public:
1179  typedef Executor executor_type;
1180 
1181  explicit initiate_async_receive_from(basic_datagram_socket* self)
1182  : self_(self)
1183  {
1184  }
1185 
1186  executor_type get_executor() const ASIO_NOEXCEPT
1187  {
1188  return self_->get_executor();
1189  }
1190 
1191  template <typename ReadHandler, typename MutableBufferSequence>
1192  void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
1193  const MutableBufferSequence& buffers, endpoint_type* sender_endpoint,
1194  socket_base::message_flags flags) const
1195  {
1196  // If you get an error on the following line it means that your handler
1197  // does not meet the documented type requirements for a ReadHandler.
1198  ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
1199 
1200  detail::non_const_lvalue<ReadHandler> handler2(handler);
1201  self_->impl_.get_service().async_receive_from(
1202  self_->impl_.get_implementation(), buffers, *sender_endpoint,
1203  flags, handler2.value, self_->impl_.get_executor());
1204  }
1205 
1206  private:
1207  basic_datagram_socket* self_;
1208  };
1209 };
1210 
1211 } // namespace asio
1212 
1213 #include "asio/detail/pop_options.hpp"
1214 
1215 #endif // ASIO_BASIC_DATAGRAM_SOCKET_HPP
int message_flags
Bitmask type for flags that can be passed to send and receive operations.
Definition: socket_base.hpp:53
basic_datagram_socket(ExecutionContext &context, const endpoint_type &endpoint, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
Definition: basic_datagram_socket.hpp:185
Definition: blocking.hpp:208
executor_type get_executor() ASIO_NOEXCEPT
Get the executor associated with the object.
Definition: basic_socket.hpp:366
std::size_t receive(const MutableBufferSequence &buffers)
Receive some data on a connected socket.
Definition: basic_datagram_socket.hpp:720
std::size_t send(const ConstBufferSequence &buffers, socket_base::message_flags flags)
Send some data on a connected socket.
Definition: basic_datagram_socket.hpp:380
std::size_t send(const ConstBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
Send some data on a connected socket.
Definition: basic_datagram_socket.hpp:408
basic_datagram_socket(ExecutionContext &context, const protocol_type &protocol, const native_handle_type &native_socket, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct a basic_datagram_socket on an existing native socket.
Definition: basic_datagram_socket.hpp:230
basic_datagram_socket(const executor_type &ex)
Construct a basic_datagram_socket without opening it.
Definition: basic_datagram_socket.hpp:87
basic_datagram_socket(const executor_type &ex, const protocol_type &protocol, const native_handle_type &native_socket)
Construct a basic_datagram_socket on an existing native socket.
Definition: basic_datagram_socket.hpp:208
std::size_t send(const ConstBufferSequence &buffers)
Send some data on a connected socket.
Definition: basic_datagram_socket.hpp:353
std::size_t receive(const MutableBufferSequence &buffers, socket_base::message_flags flags)
Receive some data on a connected socket.
Definition: basic_datagram_socket.hpp:748
Protocol::endpoint endpoint_type
The endpoint type.
Definition: basic_datagram_socket.hpp:77
basic_datagram_socket(const executor_type &ex, const protocol_type &protocol)
Construct and open a basic_datagram_socket.
Definition: basic_datagram_socket.hpp:121
Protocol protocol_type
The protocol type.
Definition: basic_datagram_socket.hpp:74
std::size_t send_to(const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags)
Send a datagram to the specified endpoint.
Definition: basic_datagram_socket.hpp:563
basic_datagram_socket(ExecutionContext &context, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct a basic_datagram_socket without opening it.
Definition: basic_datagram_socket.hpp:102
basic_socket< Protocol, Executor >::native_handle_type native_handle_type
The native representation of a socket.
Definition: basic_datagram_socket.hpp:70
Executor executor_type
The type of the executor associated with the object.
Definition: basic_datagram_socket.hpp:55
basic_datagram_socket(const executor_type &ex, const endpoint_type &endpoint)
Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
Definition: basic_datagram_socket.hpp:163
std::size_t send_to(const ConstBufferSequence &buffers, const endpoint_type &destination)
Send a datagram to the specified endpoint.
Definition: basic_datagram_socket.hpp:536
Provides datagram-oriented socket functionality.
Definition: basic_datagram_socket.hpp:36
Definition: type_traits.hpp:97
Definition: non_const_lvalue.hpp:27
detail::reactive_socket_service< Protocol >::native_handle_type native_handle_type
The native representation of a socket.
Definition: basic_socket.hpp:92
std::size_t receive(const MutableBufferSequence &buffers, socket_base::message_flags flags, asio::error_code &ec)
Receive some data on a connected socket.
Definition: basic_datagram_socket.hpp:777
Class to represent an error code value.
Definition: error_code.hpp:80
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler, void(asio::error_code, std::size_t)) async_send(const ConstBufferSequence &buffers
Start an asynchronous send on a connected socket.
basic_datagram_socket(ExecutionContext &context, const protocol_type &protocol, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct and open a basic_datagram_socket.
Definition: basic_datagram_socket.hpp:139
~basic_datagram_socket()
Destroys the socket.
Definition: basic_datagram_socket.hpp:326
std::size_t send_to(const ConstBufferSequence &buffers, const endpoint_type &destination, socket_base::message_flags flags, asio::error_code &ec)
Send a datagram to the specified endpoint.
Definition: basic_datagram_socket.hpp:590
Provides socket functionality.
Definition: basic_socket.hpp:52
std::size_t receive_from(const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags)
Receive a datagram with the endpoint of the sender.
Definition: basic_datagram_socket.hpp:934
basic_datagram_socket< Protocol, Executor1 > other
The socket type when rebound to the specified executor.
Definition: basic_datagram_socket.hpp:62
Definition: any_io_executor.hpp:28
std::size_t receive_from(const MutableBufferSequence &buffers, endpoint_type &sender_endpoint, socket_base::message_flags flags, asio::error_code &ec)
Receive a datagram with the endpoint of the sender.
Definition: basic_datagram_socket.hpp:961
std::size_t receive_from(const MutableBufferSequence &buffers, endpoint_type &sender_endpoint)
Receive a datagram with the endpoint of the sender.
Definition: basic_datagram_socket.hpp:907
Rebinds the socket type to another executor.
Definition: basic_datagram_socket.hpp:59