[#boost-urls-authority_view-port_number]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/authority_view.adoc[authority&lowbar;view]::port&lowbar;number
:relfileprefix: ../../../
:mrdocs:

Return the port

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1232[boost&sol;url&sol;authority&lowbar;view&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
uint16&lowbar;t
port&lowbar;number() const noexcept;
----

== Description

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

== Example

[,cpp]
----
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
----
== Complexity

Constant&period;

== Exception Safety

Throws nothing&period;

== BNF

[,cpp]
----
port        = *DIGIT
----
== Specification

* https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3&period;2&period;3&period; Port (rfc3986)]

== Return Value

The port number

== See Also

xref:boost/urls/authority_view/encoded_host_and_port.adoc[`encoded&lowbar;host&lowbar;and&lowbar;port`], xref:boost/urls/authority_view/has_port.adoc[`has&lowbar;port`], xref:boost/urls/authority_view/port.adoc[`port`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
