coral
A C++ library for distributed co-simulation
|
An object which identifies an endpoint for Internet communication as a combination of an address and a port number. More...
#include "coral/net.hpp"
Public Member Functions | |
Endpoint () CORAL_NOEXCEPT | |
Constructs an Endpoint with address "*" and port zero. | |
Endpoint (const ip::Address &address, const ip::Port &port) CORAL_NOEXCEPT | |
Constructs an Endpoint from an Address and a Port. | |
Endpoint (const std::string &specification) | |
Constructs an Endpoint from a string on the form "address:port", where the ":port" part is optional and defaults to port zero. More... | |
Endpoint (const sockaddr_in &sin) | |
Constructs an Endpoint from a sockaddr_in object. | |
Endpoint (const sockaddr &sa) | |
Constructs an Endpoint from a sockaddr object. More... | |
const ip::Address & | Address () const CORAL_NOEXCEPT |
Returns the address. | |
void | SetAddress (const ip::Address &value) CORAL_NOEXCEPT |
Sets the address. | |
const ip::Port & | Port () const CORAL_NOEXCEPT |
Returns the port. | |
void | SetPort_ (const ip::Port &value) CORAL_NOEXCEPT |
Sets the port. More... | |
std::string | ToString () const CORAL_NOEXCEPT |
Returns a string on the form "address:port". | |
coral::net::Endpoint | ToEndpoint (const std::string &transport) const |
Returns a coral::net::Endpoint object which refers to the same endpoint. More... | |
sockaddr_in | ToSockaddrIn () const |
Returns the endpoint address as a sockaddr_in object. More... | |
An object which identifies an endpoint for Internet communication as a combination of an address and a port number.
|
explicit |
Constructs an Endpoint from a string on the form "address:port", where the ":port" part is optional and defaults to port zero.
std::out_of_range | If the number is out of the valid port range. |
std::invalid_argument | If the specification is otherwise invalid. |
|
explicit |
Constructs an Endpoint from a sockaddr
object.
std::invalid_argument | If the address family of sa is not AF_INET . |
void coral::net::ip::Endpoint::SetPort_ | ( | const ip::Port & | value | ) |
Sets the port.
coral::net::Endpoint coral::net::ip::Endpoint::ToEndpoint | ( | const std::string & | transport | ) | const |
Returns a coral::net::Endpoint object which refers to the same endpoint.
The transport must be specified. Currently, the only supported transport is "tcp".
std::invalid_argument | If transport is empty. |
sockaddr_in coral::net::ip::Endpoint::ToSockaddrIn | ( | ) | const |
Returns the endpoint address as a sockaddr_in
object.
std::logic_error | If the address is not an IPv4 address or the port is not a normal port number. |