coral
A C++ library for distributed co-simulation
|
An object which represents an internet port number. More...
#include "coral/net.hpp"
Public Member Functions | |
Port (std::uint16_t port=0u) CORAL_NOEXCEPT | |
Constructor which takes a port number. | |
Port (const std::string &port) | |
Constructor which takes a port number in string form, or the special value "*". More... | |
bool | IsNumber () const CORAL_NOEXCEPT |
Returns whether this is a normal port number in the range 0-65535. | |
bool | IsAnyPort () const CORAL_NOEXCEPT |
Returns whether the object was initialised with the special value "*". | |
std::uint16_t | ToNumber () const |
Returns the port number. More... | |
std::string | ToString () const CORAL_NOEXCEPT |
Returns a string representation of the port number. | |
std::uint16_t | ToNetworkByteOrder () const |
Returns the port number in network byte order. More... | |
Static Public Member Functions | |
static Port | FromNetworkByteOrder (std::uint16_t nPort) CORAL_NOEXCEPT |
Constructs a Port from a port number in network byte order. | |
An object which represents an internet port number.
This object may contain a port number in the range 0 through 65535, or it may, depending on the context in which it is used, contain the special value "*", which means "any port" or "OS-assigned (ephemeral) port".
coral::net::ip::Port::Port | ( | const std::string & | port | ) |
Constructor which takes a port number in string form, or the special value "*".
std::invalid_argument | If the string does not contain a number. |
std::out_of_range | If the number is out of the valid port range. |
std::uint16_t coral::net::ip::Port::ToNetworkByteOrder | ( | ) | const |
Returns the port number in network byte order.
true
. std::uint16_t coral::net::ip::Port::ToNumber | ( | ) | const |
Returns the port number.
true
.