boost::urls::url_base::set_port_number

Set the port

Synopsis

Declared in <include/boost/url/url_base.hpp>

url_base&
set_port_number(std::uint16_t n);

Description

The port is set to the specified integer.

assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" ); this->has_authority() == true && this->has_port() == true && this->port_number() == n

Linear in `this->size()`.

Strong guarantee.

Calls to allocate may throw.

authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT
  • 3.2.3. Port (rfc3986)
  • Parameters

    Name Description
    n

    The port number to set.

    See Also

    remove_port , set_port .

    Created with MrDocs