[#boost-urls-authority_view-port_number] = xref:boost/urls/authority_view/port_number.adoc[boost::urls::authority_view::port_number] :relfileprefix: ../../../ :mrdocs: Return the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1232[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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. == Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 ); ---- == Complexity Constant. == Exception Safety Throws nothing. == BNF [,cpp] ---- port = *DIGIT ---- == Specification * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[] == Return Value The port number == See Also xref:boost/urls/authority_view/encoded_host_and_port.adoc[`encoded_host_and_port`], xref:boost/urls/authority_view/has_port.adoc[`has_port`], xref:boost/urls/authority_view/port.adoc[`port`]. [.small]#Created with https://www.mrdocs.com[MrDocs]#