port_number

Return the port

Synopsis

uint16_t port_number() noexcept;

Declared in file <src/url_view_base.cpp> at line 465

Description

If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.

Example

assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

port = *DIGIT

Specification

  • 3.2.3. Port (rfc3986)