udp::endpoint - port change
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 ? Thanks in advance, best Alex
Hey Alex,
On 3 May 2016 at 20:09, Alexander Carôt
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... Regards, Maarten
Hello Maarten, thanks a lot - this helps. Best Alex -- http://www.carot.de Email : Alexander@Carot.de Tel.: +49 (0)177 5719797
Gesendet: Dienstag, 03. Mai 2016 um 23:04 Uhr Von: "Maarten de Vries"
An: boost-users@lists.boost.org Betreff: Re: [Boost-users] udp::endpoint - port change Hey Alex,
On 3 May 2016 at 20:09, Alexander Carôt
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...
Regards, Maarten _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
"Alexander Carôt"
-
Alexander Carôt
-
Maarten de Vries