xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
socket_address.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <vector>
6#include "../core_export.h"
7#include "../object.h"
8#include "../types.h"
9#include "../ustring.h"
11
13namespace xtd {
15 namespace net {
17 class ip_end_point;
18 namespace sockets {class socket;}
20
29 public:
31 explicit socket_address(sockets::address_family address_family);
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}
Contains xtd::net::sockets::address_family enum.
Represents a network endpoint as an IP address and a port number.
Definition ip_end_point.h:20
Stores serialized information from end_point derived classes.
Definition socket_address.h:28
socket_address(sockets::address_family address_family, size_t buffer_size)
Creates a new instance of the xtd::net::socket_address class using the specified address family and b...
const byte & operator[](size_t index) const
Gets the specified index element in the underlying buffer.
byte & operator[](size_t index)
Gets or sets the specified index element in the underlying buffer.
socket_address(sockets::address_family address_family)
Creates a new instance of the xtd::net::socket_address class for the given address family.
size_t size() const
Gets the underlying buffer size of the xtd::net::socket_address.
sockets::address_family address_family() const
Gets the address family to which the endpoint belongs.
socket_address(const std::vector< byte_t > &buffer)
Creates a new instance of the xtd::net::socket_address class using the specified byte buffer .
xtd::ustring to_string() const noexcept override
Returns information about the socket address.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:26
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
#define core_export_
Define shared library export.
Definition core_export.h:13
address_family
Specifies the addressing scheme that an instance of the xtd::net::sockets::socket class can use.
Definition address_family.h:24
@ socket
Socket options apply to all sockets.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17