xtd - Reference Guide 0.2.0
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:
31 
35 
37  socket_address(sockets::address_family address_family, size_t buffer_size);
38 
40  explicit socket_address(const std::vector<byte_t>& buffer);
42 
45  socket_address& operator=(const socket_address& socket_address) = default;
46  friend std::ostream& operator <<(std::ostream& os, const socket_address& socket_address) noexcept {return os << socket_address.to_string();}
48 
50 
55 
58  size_t size() const;
60 
62 
70  byte& operator[](size_t index);
71 
78  const byte& operator[](size_t index) const;
80 
82 
87  xtd::ustring to_string() const noexcept override;
89 
90  private:
91  friend class ip_end_point;
92  friend class sockets::socket;
93  std::vector<byte_t> bytes_;
94  };
95  }
96 }
Implements the Berkeley sockets interface.
Definition: socket.h:68
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: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
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:30
Contains xtd::net::sockets::address_family enum.
uint8_t byte
Represents a 8-bit unsigned integer.
Definition: types.h:81
address_family
Specifies the addressing scheme that an instance of the xtd::net::sockets::socket class can use...
Definition: address_family.h:27