xtd 0.2.0
Loading...
Searching...
No Matches
socket_async_event_args.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "socket.hpp"
7#include "socket_flags.hpp"
11#include "../../any.hpp"
12#include "../../delegate.hpp"
13#include "../../event.hpp"
14#include "../../event_args.hpp"
15#include <memory>
16#include <vector>
17
19#undef unix
21
23namespace xtd {
25 namespace net {
27 namespace sockets {
55 public:
57
70 explicit socket_async_event_args(bool suppress_execution_context_flow);
72
74
84 socket_async_event_args& accept_socket(const xtd::net::sockets::socket& value) noexcept;
85
90 const std::vector<xtd::byte>& buffer() const noexcept;
95 std::vector<xtd::byte>& buffer() noexcept;
97
99
103 void set_buffer(const std::vector<xtd::byte>& memory_buffer);
104
112 void set_buffer(size_t offset, size_t count);
120 void set_buffer(const std::vector<xtd::byte>& buffer, size_t offset, size_t count);
122
124
131 xtd::event<socket_async_event_args, xtd::delegate<void(const socket_async_event_args&)>> completed;
133
134 protected:
136
145 virtual void on_complete(const socket_async_event_args& e);
147
148 private:
149 friend socket;
150 xtd::net::sockets::socket accept_socket_;
151 std::vector<xtd::byte> buffer_;
152 std::vector<std::vector<xtd::byte>> buffer_list_;
153 size_t bytes_transferred_ = 0;
154 xtd::uptr<xtd::exception> connect_by_name_error_;
155 xtd::net::sockets::socket connect_socket_;
156 size_t count_ = 0;
157 bool disconnect_reuse_socket_ = false;
158 xtd::net::sockets::socket_async_operation last_operation = xtd::net::sockets::socket_async_operation::none;
159 std::vector<xtd::byte> memory_buffer_;
160 size_t offset_ = 0;
161 xtd::net::sockets::ip_packet_information receive_message_from_packet_info_;
162 xtd::uptr<xtd::net::end_point> remote_end_point_;
163 std::vector<xtd::net::sockets::send_packets_element> send_packets_elements_;
164 xtd::net::sockets::transmit_file_options send_packets_flags_ = xtd::net::sockets::transmit_file_options::use_default_worker_thread;
165 size_t send_packets_send_size_ = 0;
166 xtd::net::sockets::socket_error socket_error_ = xtd::net::sockets::socket_error::success;
167 xtd::net::sockets::socket_flags socket_flags_ = xtd::net::sockets::socket_flags::none;
168 std::any user_token_;
169 };
170 }
171 }
172}
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.hpp:28
Identifies a network address. This is an abstract class.
Definition end_point.hpp:27
Gets the network interface information that is associated with a call to xtd::net::sockets::socket::r...
Definition ip_packet_information.hpp:36
Represents an element in a xtd::net::sockets::send_packets_element array.
Definition send_packets_element.hpp:41
Represents an asynchronous socket operation.
Definition socket_async_event_args.hpp:54
socket_async_event_args(bool suppress_execution_context_flow)
Initializes the SocketAsyncEventArgs.
xtd::net::sockets::socket accept_socket() const noexcept
Gets the socket to use or the socket created for accepting a connection with an asynchronous socket m...
socket_async_event_args()=default
Creates an empty xtd::net::sockets::socket_async_event_args instance.
Implements the Berkeley sockets interface.
Definition socket.hpp:74
#define core_export_
Define shared library export.
Definition core_export.hpp:13
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
socket_error
Defines error codes for the xtd::net::sockets::socket class.
Definition socket_error.hpp:30
transmit_file_options
The TransmitFileOptions enumeration defines values used in file transfer requests.
Definition transmit_file_options.hpp:32
socket_async_operation
The type of asynchronous socket operation most recently performed with this context object.
Definition socket_async_operation.hpp:32
socket_flags
Specifies socket send and receive behaviors. This enumeration has a flags attribute that allows a bit...
Definition socket_flags.hpp:30
Contains xtd::net::sockets::ip_packet_information class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::net::sockets::send_packets_element class.
Contains xtd::net::sockets::socket class.
Contains xtd::net::sockets::socket_async_operation enum.
Contains xtd::net::sockets::socket_flags enum.
Contains xtd::net::sockets::transmit_file_options enum.