xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
socket_address.h
Go to the documentation of this file.
1 #pragma once
4 
5 #include <vector>
6 #include "../core_export.h"
7 #include "../object.h"
8 #include "../types.h"
9 #include "../ustring.h"
10 #include "sockets/address_family.h"
11 
13 namespace xtd {
15  namespace net {
17  class ip_end_point;
18  namespace sockets {class socket;}
20 
28  class core_export_ socket_address : public xtd::object {
29  public:
32 
34  socket_address(sockets::address_family address_family, size_t buffer_size);
35 
37  explicit socket_address(const std::vector<byte_t>& buffer);
38 
41  socket_address& operator=(const socket_address& socket_address) = default;
42  friend std::ostream& operator <<(std::ostream& os, const socket_address& socket_address) noexcept {return os << socket_address.to_string();}
44 
48 
51  size_t size() const;
52 
59  byte& operator[](size_t index);
60 
67  const byte& operator[](size_t index) const;
68 
72  xtd::ustring to_string() const noexcept override;
73 
74  private:
75  friend class ip_end_point;
76  friend class sockets::socket;
77  std::vector<byte_t> bytes_;
78  };
79  }
80 }
Implements the Berkeley sockets interface.
Definition: socket.h:63
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
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Stores serialized information from end_point derived classes.
Definition: socket_address.h:28
xtd::ustring to_string() const noexcept override
Returns information about the socket address.
Socket options apply to all sockets.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:26
Contains xtd::net::sockets::address_family enum.
uint8_t byte
Represents a 8-bit unsigned integer.
Definition: types.h:81
size_t size
Represents a size of any object in bytes.
Definition: types.h:171
address_family
Specifies the addressing scheme that an instance of the xtd::net::sockets::socket class can use...
Definition: address_family.h:24
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