xtd 0.2.0
Loading...
Searching...
No Matches
xtd::net::ip_end_point Class Reference
Inheritance diagram for xtd::net::ip_end_point:
xtd::net::end_point xtd::object

Definition

Represents a network endpoint as an IP address and a port number.

Remarks
The xtd::net::ip_end_point class contains the host and local or remote port information needed by an application to connect to a service on a host. By combining the host's IP address and port number of a service, the ip_end_point class forms a connection point to a service.
Header
#include <xtd/net/ip_end_point>
Namespace
xtd::net
Library
xtd.core
Examples
network_stream.cpp, socket_tcp_ip_v4.cpp, socket_tcp_ip_v4_without_thread.cpp, socket_tcp_ip_v6.cpp, socket_udp_ip_v4.cpp, socket_udp_ip_v6.cpp, tcp_client_ip_v6.cpp, udp_client_ip_v4.cpp, and udp_client_ip_v6.cpp.

Public Fields

static constexpr uint16 min_port
 Specifies the minimum value that can be assigned to the port property. The min_port value is set to 0x0000. This field is read-only.
 
static constexpr uint16 max_port
 Specifies the maximum value that can be assigned to the port property. The max_port value is set to 0xFFFF. This field is read-only.
 

Public Constructors

 ip_end_point (uint32 address, uint16 port)
 Initializes a new instance of the xtd::net::ip_end_point class.
 
 ip_end_point (const xtd::net::ip_address &address, uint16 port)
 Initializes a new instance of the xtd::net::ip_end_point class.
 

Public Properties

const xtd::net::ip_addressaddress () const noexcept
 Gets the IP address of the endpoint.
 
ip_end_pointaddress (const xtd::net::ip_address &value)
 Sets the IP address of the endpoint.
 
uint16 port () const noexcept
 Gets or sets the port number of the endpoint.
 
ip_end_pointport (uint16 value)
 Sets the port number of the endpoint.
 

Public Methods

std::unique_ptr< end_pointcreate (const xtd::net::socket_address &socket_address) const override
 Creates an xtd::net::end_point instance from a xtd::net::socket_address instance.
 
xtd::net::socket_address serialize () const override
 Serializes endpoint information into a socket_address instance.
 
xtd::ustring to_string () const noexcept override
 Returns a string that represents the current object.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::net::end_point
sockets::address_family address_family () const noexcept
 Gets the address family to which the endpoint belongs.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object.
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
- Protected Member Functions inherited from xtd::net::end_point
 end_point (sockets::address_family address_family)
 Initializes a new instance of the xtd::net::end_point class.
 

Constructor & Destructor Documentation

◆ ip_end_point() [1/2]

xtd::net::ip_end_point::ip_end_point ( uint32  address,
uint16  port 
)

Initializes a new instance of the xtd::net::ip_end_point class.

Parameters
addressThe IP address of the Internet host.
portThe port number associated with the address, or 0 to specify any available port. port is in host order.

◆ ip_end_point() [2/2]

xtd::net::ip_end_point::ip_end_point ( const xtd::net::ip_address address,
uint16  port 
)

Initializes a new instance of the xtd::net::ip_end_point class.

Parameters
addressAn xtd::net::ip_address.
portThe port number associated with the address, or 0 to specify any available port. port is in host order.

Member Function Documentation

◆ address() [1/2]

const xtd::net::ip_address & xtd::net::ip_end_point::address ( ) const
noexcept

Gets the IP address of the endpoint.

Returns
An xtd::net::ip_address instance containing the IP address of the endpoint.

◆ address() [2/2]

ip_end_point & xtd::net::ip_end_point::address ( const xtd::net::ip_address value)

Sets the IP address of the endpoint.

Parameters
valueAn ip_address instance containing the IP address of the endpoint.
Returns
The current instance.

◆ create()

std::unique_ptr< end_point > xtd::net::ip_end_point::create ( const xtd::net::socket_address socket_address) const
overridevirtual

Creates an xtd::net::end_point instance from a xtd::net::socket_address instance.

Parameters
socket_addressThe socket address that serves as the endpoint for a connection.
Returns
A new end_point instance that is initialized from the specified xtd::net::socket_address instance.
Exceptions
xtd::not_supported_exceptionAny attempt is made to access the method when the method is not overridden in a descendant class.

Reimplemented from xtd::net::end_point.

◆ port() [1/2]

uint16 xtd::net::ip_end_point::port ( ) const
noexcept

Gets or sets the port number of the endpoint.

Parameters
valueAn integer value in the range min_port to max_port indicating the port number of the endpoint.

◆ port() [2/2]

ip_end_point & xtd::net::ip_end_point::port ( uint16  value)

Sets the port number of the endpoint.

Parameters
valueAn integer value in the range min_port to max_port indicating the port number of the endpoint.

◆ serialize()

xtd::net::socket_address xtd::net::ip_end_point::serialize ( ) const
overridevirtual

Serializes endpoint information into a socket_address instance.

Returns
A new xtd::net::socket_address instance that contains the endpoint information.

Reimplemented from xtd::net::end_point.

◆ to_string()

xtd::ustring xtd::net::ip_end_point::to_string ( ) const
overridevirtualnoexcept

Returns a string that represents the current object.

Returns
string A string that represents the current object.

Reimplemented from xtd::net::end_point.

Member Data Documentation

◆ max_port

constexpr uint16 xtd::net::ip_end_point::max_port
staticconstexpr

Specifies the maximum value that can be assigned to the port property. The max_port value is set to 0xFFFF. This field is read-only.

◆ min_port

constexpr uint16 xtd::net::ip_end_point::min_port
staticconstexpr

Specifies the minimum value that can be assigned to the port property. The min_port value is set to 0x0000. This field is read-only.


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