Boost.URL

    • Quick Look
    • URLs
      • Parsing
      • Containers
      • Segments
      • Params
      • Normalization
      • String Token
      • Percent Encoding
      • Formatting
    • Customization
      • Parse Rules
      • Character Sets
      • Compound Rules
      • Ranges
      • RFC 3986
    • Examples
      • QR Code
      • Finicky
      • mailto URLs
      • Magnet Link
      • File Router
      • Router
      • Sanitizing URLs
    • Reference
      • Index
      • Concepts
        • CharSet
        • Rule
        • StringToken
      • Help Card

boost::urls::url_view_base::port_number

Return the port

Synopsis

Declared in header <boost/url/url_view_base.hpp>

std::uint16_t
port_number() const noexcept;

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.

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

Constant.

Throws nothing.

port        = *DIGIT
  • 3.2.3. Port (rfc3986)

See Also

encoded_host_and_port , has_port , port .