Clementine
Public Types | Public Member Functions | Friends | Related Functions | List of all members
asio::ip::basic_endpoint< InternetProtocol > Class Template Reference

Describes an endpoint for a version-independent IP socket. More...

#include <basic_endpoint.hpp>

Public Types

typedef InternetProtocol protocol_type
 The protocol type associated with the endpoint.
 
typedef asio::detail::socket_addr_type data_type
 The type of the endpoint structure. More...
 

Public Member Functions

 basic_endpoint () ASIO_NOEXCEPT
 Default constructor.
 
 basic_endpoint (const InternetProtocol &internet_protocol, unsigned short port_num) ASIO_NOEXCEPT
 Construct an endpoint using a port number, specified in the host's byte order. More...
 
 basic_endpoint (const asio::ip::address &addr, unsigned short port_num) ASIO_NOEXCEPT
 Construct an endpoint using a port number and an IP address. More...
 
 basic_endpoint (const basic_endpoint &other) ASIO_NOEXCEPT
 Copy constructor.
 
basic_endpointoperator= (const basic_endpoint &other) ASIO_NOEXCEPT
 Assign from another endpoint.
 
protocol_type protocol () const ASIO_NOEXCEPT
 The protocol associated with the endpoint.
 
data_typedata () ASIO_NOEXCEPT
 Get the underlying endpoint in the native type.
 
const data_typedata () const ASIO_NOEXCEPT
 Get the underlying endpoint in the native type.
 
std::size_t size () const ASIO_NOEXCEPT
 Get the underlying size of the endpoint in the native type.
 
void resize (std::size_t new_size)
 Set the underlying size of the endpoint in the native type.
 
std::size_t capacity () const ASIO_NOEXCEPT
 Get the capacity of the endpoint in the native type.
 
unsigned short port () const ASIO_NOEXCEPT
 Get the port associated with the endpoint. More...
 
void port (unsigned short port_num) ASIO_NOEXCEPT
 Set the port associated with the endpoint. More...
 
asio::ip::address address () const ASIO_NOEXCEPT
 Get the IP address associated with the endpoint.
 
void address (const asio::ip::address &addr) ASIO_NOEXCEPT
 Set the IP address associated with the endpoint.
 

Friends

bool operator== (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
 Compare two endpoints for equality.
 
bool operator!= (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
 Compare two endpoints for inequality.
 
bool operator< (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
 Compare endpoints for ordering.
 
bool operator> (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
 Compare endpoints for ordering.
 
bool operator<= (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
 Compare endpoints for ordering.
 
bool operator>= (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
 Compare endpoints for ordering.
 

Related Functions

(Note that these are not member functions.)

template<typename Elem , typename Traits , typename InternetProtocol >
std::basic_ostream< Elem, Traits > & operator<< (std::basic_ostream< Elem, Traits > &os, const basic_endpoint< InternetProtocol > &endpoint)
 Output an endpoint as a string. More...
 

Detailed Description

template<typename InternetProtocol>
class asio::ip::basic_endpoint< InternetProtocol >

Describes an endpoint for a version-independent IP socket.

The asio::ip::basic_endpoint class template describes an endpoint that may be associated with a particular socket.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.
Concepts:
Endpoint.

Member Typedef Documentation

◆ data_type

template<typename InternetProtocol>
typedef asio::detail::socket_addr_type asio::ip::basic_endpoint< InternetProtocol >::data_type

The type of the endpoint structure.

This type is dependent on the underlying implementation of the socket layer.

Constructor & Destructor Documentation

◆ basic_endpoint() [1/2]

template<typename InternetProtocol>
asio::ip::basic_endpoint< InternetProtocol >::basic_endpoint ( const InternetProtocol &  internet_protocol,
unsigned short  port_num 
)
inline

Construct an endpoint using a port number, specified in the host's byte order.

The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.

Examples
To initialise an IPv4 TCP endpoint for port 1234, use:

To specify an IPv6 UDP endpoint for port 9876, use:

◆ basic_endpoint() [2/2]

template<typename InternetProtocol>
asio::ip::basic_endpoint< InternetProtocol >::basic_endpoint ( const asio::ip::address addr,
unsigned short  port_num 
)
inline

Construct an endpoint using a port number and an IP address.

This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.

Member Function Documentation

◆ port() [1/2]

template<typename InternetProtocol>
unsigned short asio::ip::basic_endpoint< InternetProtocol >::port ( ) const
inline

Get the port associated with the endpoint.

The port number is always in the host's byte order.

◆ port() [2/2]

template<typename InternetProtocol>
void asio::ip::basic_endpoint< InternetProtocol >::port ( unsigned short  port_num)
inline

Set the port associated with the endpoint.

The port number is always in the host's byte order.

Friends And Related Function Documentation

◆ operator<<()

template<typename Elem , typename Traits , typename InternetProtocol >
std::basic_ostream< Elem, Traits > & operator<< ( std::basic_ostream< Elem, Traits > &  os,
const basic_endpoint< InternetProtocol > &  endpoint 
)
related

Output an endpoint as a string.

Used to output a human-readable string for a specified endpoint.

Parameters
osThe output stream to which the string will be written.
endpointThe endpoint to be written.
Returns
The output stream.

The documentation for this class was generated from the following file: