xtd 0.2.0
xtd::net::dns_end_point Class Reference
Inheritance diagram for xtd::net::dns_end_point:
xtd::net::end_point xtd::iequatable< xtd::net::dns_end_point > xtd::object xtd::interface xtd::extensions::equality_operators< type_t, equatable_t >

Definition

Represents a network endpoint as a host name or a string representation of an IP address and a port number.

Definition
class core_export_ dns_end_point : public xtd::net::end_point, public xtd::iequatable<xtd::net::dns_end_point>;
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Represents a network endpoint as a host name or a string representation of an IP address and a port n...
Definition dns_end_point.hpp:26
Identifies a network address. This is an abstract class.
Definition end_point.hpp:27
#define core_export_
Define shared library export.
Definition core_export.hpp:13
Header
#include <xtd/net/dns_end_point>
Namespace
xtd::net
Library
xtd.core

Public Constructors

 dns_end_point (const xtd::string &host, uint16 port)
 Initializes a new instance of the xtd::net::dns_end_point class with the host name or string representation of an IP address and a port number.
 
 dns_end_point (const xtd::string &host, uint16 port, sockets::address_family address_family)
 Initializes a new instance of the xtd::net::dns_end_point class with the host name or string representation of an IP address, a port number, and an address family.
 

Public Properties

const xtd::stringhost () const noexcept
 Gets the host name or string representation of the Internet Protocol (IP) address of the host.
 
uint16 port () const noexcept
 Gets the port number of the endpoint.
 

Public Methods

bool equals (const object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const dns_end_point &other) const noexcept override
 Determines whether the specified object is equal to the current object.
 
xtd::size get_hash_code () const noexcept override
 Serves as a hash function for a particular type.
 
xtd::string 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.
 
virtual xtd::uptr< end_pointcreate (const socket_address &socket_address) const
 Creates an xtd::net::end_point instance from a socket_address instance.
 
virtual socket_address serialize () const
 Serializes endpoint information into a socket_address instance.
 
string to_string () const noexcept override
 Returns a string that represents the current object.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< xtd::net::dns_end_point >
- Static Public Member Functions inherited from xtd::object
template<class object_a_t , class object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<class object_a_t , class object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &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

◆ dns_end_point() [1/2]

xtd::net::dns_end_point::dns_end_point ( const xtd::string host,
uint16  port 
)

Initializes a new instance of the xtd::net::dns_end_point class with the host name or string representation of an IP address and a port number.

Parameters
hostThe host name or a string representation of the IP address.
portThe port number associated with the address, or 0 to specify any available port. port is in host order.
Exceptions
xtd::argument_exceptionThe host parameter contains an empty string.
Remarks
The xtd::dns_end_point::dns_end_point(const xtd::string& host, int32 port) constructor can be used to initialize a xtd::net::dns_end_point class using either a host name or a string that represents an IP address and a port. This constructor sets the xtd::net::sockets::address_family property to xtd::net::sockets::address_family::unknown.
When using this constructor with a host name rather than a string representation of an IP address, the address family of the dns_end_point will remain Unknown even after use. The xtd::net::sockets::address_family property of any Socket that is created by calls to the ConnectAsync method will be the address family of the first address to which a connection can be successfully established (not necessarily the first address to be resolved).

◆ dns_end_point() [2/2]

xtd::net::dns_end_point::dns_end_point ( const xtd::string host,
uint16  port,
sockets::address_family  address_family 
)

Initializes a new instance of the xtd::net::dns_end_point class with the host name or string representation of an IP address, a port number, and an address family.

Parameters
hostThe host name or a string representation of the IP address.
portThe port number associated with the address, or 0 to specify any available port. port is in host order.
address_familyOne of the xtd::net::sockets::address_family values.
Exceptions
xtd::argument_exceptionThe host parameter contains an empty string.
Remarks
The xtd::dns_end_point::dns_end_point(const xtd::string& host, int32 port, xtd::net::sockets::address_family) constructor can be used to initialize a dns_end_point class using either a host name or a string that represents an IP address, a port, and an address family.
When using the constructor with a host name rather than a string representation of an IP address, the address family restricts DNS resolution to prefer addresses of the specified address family value. When using the constructor with the address family specified as Unknown, the address family of the dns_end_point will remain Unknown even after use. The xtd::net::sockets::address_family property of any Socket that is created by calls to the ConnectAsync method will be the address family of the first address to which a connection can be successfully established (not necessarily the first address to be resolved).

Member Function Documentation

◆ host()

const xtd::string & xtd::net::dns_end_point::host ( ) const
noexcept

Gets the host name or string representation of the Internet Protocol (IP) address of the host.

Returns
The host name or a string representation of the IP address.

◆ port()

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

Gets the port number of the endpoint.

Returns
An integer value in the range xtd::net::ip_end_point::min_port to xtd::net::ip_end_point::max_port indicating the port number of the endpoint.

◆ equals() [1/2]

bool xtd::net::dns_end_point::equals ( const object obj) const
overridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.

Reimplemented from xtd::object.

◆ equals() [2/2]

bool xtd::net::dns_end_point::equals ( const dns_end_point other) const
overridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
otherThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.

Implements xtd::iequatable< xtd::net::dns_end_point >.

◆ get_hash_code()

xtd::size xtd::net::dns_end_point::get_hash_code ( ) const
overridevirtualnoexcept

Serves as a hash function for a particular type.

Returns
A hash code for the current object.

Reimplemented from xtd::object.

◆ to_string()

xtd::string xtd::net::dns_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::object.


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