xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
ip_end_point.h
Go to the documentation of this file.
1 #pragma once
5 
6 #include "end_point.h"
7 #include "ip_address.h"
8 
10 namespace xtd {
12  namespace net {
21  public:
23  static constexpr const uint16_t min_port = 0x0000;
25  static constexpr const uint16_t max_port = 0xFFFF;
26 
30  ip_end_point(uint32_t address, uint16_t port);
31 
35  ip_end_point(const xtd::net::ip_address& address, uint16_t port);
36 
38  ip_end_point() = default;
39  ip_end_point(ip_end_point&&) = default;
40  ip_end_point(const ip_end_point&) = default;
41  ip_end_point& operator=(const ip_end_point&) = default;
42  friend std::ostream& operator <<(std::ostream& os, const ip_end_point& end_point) noexcept {return os << end_point.to_string();}
44 
47  const xtd::net::ip_address& address() const noexcept;
51  ip_end_point& address(const xtd::net::ip_address& value);
52 
55  uint16_t port() const noexcept;
58  ip_end_point& port(uint16_t value);
59 
64  std::unique_ptr<end_point> create(const xtd::net::socket_address& socket_address) const override;
65 
68  xtd::net::socket_address serialize() const override;
69 
72  xtd::ustring to_string() const noexcept override;
73 
74  private:
75  xtd::net::ip_address address_;
76  uint16_t port_ = 0;
77  };
78  }
79 }
Identifies a network address. This is an abstract class.
Definition: end_point.h:24
ustring to_string() const noexcept override
Returns a string that represents the current object.
Provides an Internet Protocol (IP) address.
Definition: ip_address.h:30
Represents a network endpoint as an IP address and a port number.
Definition: ip_end_point.h:20
ip_end_point(uint32_t address, uint16_t port)
Initializes a new instance of the xtd::net::ip_end_point class.
const xtd::net::ip_address & address() const noexcept
Gets the IP address of the endpoint.
ip_end_point(const xtd::net::ip_address &address, uint16_t port)
Initializes a new instance of the xtd::net::ip_end_point class.
Stores serialized information from end_point derived classes.
Definition: socket_address.h:28
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::net::end_point class.
#define core_export_
Define shared library export.
Definition: core_export.h:13
std::string to_string(const value_t &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: to_string.h:37
Contains xtd::net::ip_address class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17