|
Boost Users : |
Subject: Re: [Boost-users] udp::endpoint - port change
From: Maarten de Vries (maarten_at_[hidden])
Date: 2016-05-03 17:04:43
Hey Alex,
On 3 May 2016 at 20:09, Alexander Carôt <Alexander_Carot_at_[hidden]> wrote:
> Hello all,
>
> probably trivial but I am currently stuck with this:
>
> I create a UDP endpoint via
>
> udp::resolver::query query(udp::v4(),IP,port);
>
> destinationEndpoint = new udp::endpoint(*resolver.resolve(query));
>
> but after the creation I want to change the port without deleting and
> recreating it with different parameters.
>
> How can I do this ?
>
âYou can change the port of an existing endpoint using the port() member
function [1].
Creating the endpoint with new seems a bit overkill though. Unless you have
a specific reason I wouldn't allocate them on the heap.
â[1]
http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/ip__basic_endpoint/port.html
â
Regards,
Maarten
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