xtd 0.2.0
socket_address.hpp
Go to the documentation of this file.
1
3#pragma once
5#include "../core_export.hpp"
6#include "../array.hpp"
7#include "../iequatable.hpp"
8#include "../object.hpp"
9#include "../types.hpp"
10#include "../string.hpp"
11
13namespace xtd {
15 namespace net {
17 class ip_end_point;
18 namespace sockets {class socket;}
20
36 class core_export_ socket_address : public xtd::object, public xtd::iequatable<xtd::net::socket_address> {
37 public:
39
42 explicit socket_address(sockets::address_family address_family);
43
45 socket_address(sockets::address_family address_family, size_t buffer_size);
46
48 explicit socket_address(const xtd::array<xtd::byte>& buffer);
50
53 socket_address& operator =(const socket_address& socket_address) = default;
55
57
62
65 size_t size() const;
67
69
77 byte& operator [](size_t index);
78
85 const byte& operator [](size_t index) const;
87
89
94 bool equals(const object& obj) const noexcept override;
98 bool equals(const socket_address& other) const noexcept override;
99
102 xtd::size get_hash_code() const noexcept override;
103
107 xtd::string to_string() const noexcept override;
109
110 private:
111 friend class ip_end_point;
112 friend class sockets::socket;
113 xtd::array<xtd::byte> bytes_;
114 };
115 }
116}
Contains xtd::net::sockets::address_family enum.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:59
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Represents a network endpoint as an IP address and a port number.
Definition ip_end_point.hpp:28
Stores serialized information from end_point derived classes. #par Deinition.
Definition socket_address.hpp:36
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
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...
socket_address(const xtd::array< xtd::byte > &buffer)
Creates a new instance of the xtd::net::socket_address class using the specified byte buffer .
bool equals(const socket_address &other) const noexcept override
Determines whether the specified object is equal to the current object.
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.
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
sockets::address_family address_family() const
Gets the address family to which the endpoint belongs.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
@ socket
The socket is not valid.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
address_family
Specifies the addressing scheme that an instance of the xtd::net::sockets::socket class can use.
Definition address_family.hpp:30
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10