Bind the socket to the given local endpoint. * This function binds the socket to the specified endpoint on the local * machine. * * @param endpoint An endpoint on the local machine to which the socket will * be bound. * * @throws asio::system_error Thrown on failure. * * @par Example * @code * asio::ip::tcp::socket socket(my_context); * socket.open(asio::ip::tcp::v
| 781 | * @endcode |
| 782 | */ |
| 783 | void bind(const endpoint_type& endpoint) |
| 784 | { |
| 785 | asio::error_code ec; |
| 786 | impl_.get_service().bind(impl_.get_implementation(), endpoint, ec); |
| 787 | asio::detail::throw_error(ec, "bind"); |
| 788 | } |
| 789 | |
| 790 | /// Bind the socket to the given local endpoint. |
| 791 | /** |