Boost logo

Boost Users :

Subject: [Boost-users] UDP: socket::open does not take an endpoint
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2013-05-08 16:01:06


Hello,

boost::asio::ip::udp::socket offers two ways to open:

a) pass io_service and endpoint to the socket::socket

b) pass io_service to socket::socket, then call socket::open

===

The UDP async server example uses method (a):

boost::asio::ip::udp::socket Socket(
  IoService,
  boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 13));

===

Question 1:

Why doesn't boost UDP allow me to use method (b) with an endpoint?
For example, this is impossible:

  boost::asio::ip::udp::socket Socket(IoService);

  Socket.open(boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 13));

  // error: open does not take a boost::asio::ip::udp::endpoint

===

Question 2:

How can I modify the UDP async server example to use method (b)?

Thank you,

Chris


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net