Set the port

Synopsis

Declared in header </boost/url/url_base.hpp#L1522[boost/url/url_base.hpp,window=blank_]>

url_base&
set_port_number(uint16_t n);

Description

The port is set to the specified integer.

Example

assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" );

Postconditions

this->has_authority() == true && this->has_port() == true && this->port_number() == n

Complexity

Linear in this->size().

Exception Safety

Strong guarantee. Calls to allocate may throw.

BNF

authority     = [ userinfo "@" ] host [ ":" port ]

port          = *DIGIT

Specification

Return Value

  • ``

Parameters

Name Type

n

uint16_t