xtd - Reference Guide 0.2.0
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 {
20  class core_export_ ip_end_point : public xtd::net::end_point {
21  public:
23 
26  static constexpr const uint16_t min_port = 0x0000;
28  static constexpr const uint16_t max_port = 0xFFFF;
30 
32 
37  ip_end_point(uint32_t address, uint16_t port);
38 
42  ip_end_point(const xtd::net::ip_address& address, uint16_t port);
44 
46  ip_end_point() = default;
47  ip_end_point(ip_end_point&&) = default;
48  ip_end_point(const ip_end_point&) = default;
49  ip_end_point& operator=(const ip_end_point&) = default;
50  friend std::ostream& operator <<(std::ostream& os, const ip_end_point& end_point) noexcept {return os << end_point.to_string();}
52 
54 
58  const xtd::net::ip_address& address() const noexcept;
62  ip_end_point& address(const xtd::net::ip_address& value);
63 
66  uint16_t port() const noexcept;
69  ip_end_point& port(uint16_t value);
71 
73 
79  std::unique_ptr<end_point> create(const xtd::net::socket_address& socket_address) const override;
80 
83  xtd::net::socket_address serialize() const override;
84 
87  xtd::ustring to_string() const noexcept override;
89 
90  private:
91  xtd::net::ip_address address_;
92  uint16_t port_ = 0;
93  };
94  }
95 }
Provides an Internet Protocol (IP) address.
Definition: ip_address.h:34
Identifies a network address. This is an abstract class.
Definition: end_point.h:24
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents a network endpoint as an IP address and a port number.
Definition: ip_end_point.h:20
Contains xtd::net::end_point class.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1110
Stores serialized information from end_point derived classes.
Definition: socket_address.h:28
Contains xtd::net::ip_address class.
ustring to_string() const noexcept override
Returns a string that represents the current object.