81 explicit async_result_socket(
const xtd::any_object& async_state) : async_state_(async_state) {}
82 xtd::any_object async_state()
const noexcept override {
return async_state_;}
84 bool completed_synchronously()
const noexcept override {
return false;}
85 bool is_completed()
const noexcept override {
return is_completed_;};
88 bool is_completed_ =
false;
91 std::exception_ptr exception_;
95 class async_result_accept :
public async_result_socket {
97 explicit async_result_accept(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
102 class async_result_connect :
public async_result_socket {
104 explicit async_result_connect(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
108 class async_result_disconnect :
public async_result_socket {
110 explicit async_result_disconnect(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
114 class async_result_receive :
public async_result_socket {
116 explicit async_result_receive(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
121 class async_result_receive_from :
public async_result_socket {
123 explicit async_result_receive_from(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
129 class async_result_receive_message_from :
public async_result_socket {
131 explicit async_result_receive_message_from(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
139 class async_result_send :
public async_result_socket {
141 explicit async_result_send(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
146 class async_result_send_to :
public async_result_socket {
148 explicit async_result_send_to(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
311 [[nodiscard]] auto
is_bound() const noexcept ->
bool;
490 [[nodiscard]] auto
ttl() const ->
xtd::
byte;
583 template<class end_point_t>
800 template<
class end_po
int_t>
833 template<
class end_po
int_t>
Contains xtd::net::sockets::address_family enum.
Contains xtd::argument_exception exception.
Contains xtd::array class.
Contains xtd::async_callback delegate.
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents the status of an asynchronous operation.
Definition iasync_result.hpp:25
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:22
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Identifies a network address. This is an abstract class.
Definition end_point.hpp:27
Provides an Internet Protocol (IP) address.
Definition ip_address.hpp:42
Contains option values for joining an IPv6 multicast group.
Definition ip_v6_multicast_option.hpp:33
Specifies whether a xtd::net::sockets::socket will remain connected after a call to the xtd::net::soc...
Definition linger_option.hpp:35
Contains IPAddress values used to join and drop multicast groups.
Definition multicast_option.hpp:39
Represents an asynchronous socket operation.
Definition socket_async_event_args.hpp:54
auto end_receive(xtd::sptr< xtd::iasync_result > async_result) -> xtd::size
Ends a pending asynchronous read.
auto begin_send(const xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Sends data asynchronously to a connected xtd::net::sockets::socket::socket.
auto begin_disconnect(bool reuse_socket, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins an asynchronous request to disconnect from a remote endpoint.
auto accept_async(xtd::net::sockets::socket_async_event_args &e) -> bool
Begins an asynchronous operation to accept an incoming connection attempt.
auto set_ip_protection_level(xtd::net::sockets::ip_protection_level level) -> void
Sets the IP protection level on a socket.
socket(xtd::net::sockets::address_family address_family, xtd::net::sockets::socket_type socket_type, xtd::net::sockets::protocol_type protocol_type)
Initializes a new instance of the xtd::net::sockets::socket class using the specified address family,...
socket(xtd::intptr handle)
Initializes a new instance of the xtd::net::sockets::socket class for the specified socket handle.
auto no_delay() const -> bool
Gets a boolean value that specifies whether the stream xtd::net::sockets::socket is using the Nagle a...
auto begin_receive(xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size size, xtd::net::sockets::socket_flags socket_flags, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket.
auto begin_send(const xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size size, xtd::net::sockets::socket_flags socket_flags, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Sends data asynchronously to a connected xtd::net::sockets::socket::socket.
auto receive(xtd::array< xtd::byte > &buffer) -> xtd::size
Receives data from a bound xtd::net::sockets::socket into a receive buffer.
auto get_raw_socket_option(xtd::int32 socket_option_level, xtd::int32 socket_option_name, xtd::intptr option_value, xtd::size size_option_value) const -> xtd::size
Gets a socket option value using platform-specific level and name identifiers.
auto get_socket_option(xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name) const -> xtd::int32
Returns the value of a specified xtd::net::sockets::socket option, represented as integer.
auto connected() const noexcept -> bool
Gets a value that indicates whether a xtd::net::sockets::socket is connected to a remote host as of t...
auto end_receive(xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code) -> xtd::size
Ends a pending asynchronous read.
auto set_raw_socket_option(xtd::int32 socket_option_level, xtd::int32 socket_option_name, xtd::intptr option_value, xtd::size option_value_size) -> void
Sets a socket option value using platform-specific level and name identifiers.
static auto select(xtd::collections::generic::ilist< socket > &check_read, xtd::collections::generic::ilist< socket > &check_write, xtd::collections::generic::ilist< socket > &check_error, xtd::int32 microseconds) -> xtd::size
Determines the status of one or more sockets.
auto linger_state() const -> xtd::net::sockets::linger_option
Gets a value that specifies whether the xtd::net::sockets::socket will delay closing a socket in an a...
auto send_to(const xtd::array< xtd::byte > &buffer, const xtd::net::end_point &remote_end_point) -> xtd::size
Sends data to the specified endpoint.
auto handle() const noexcept -> xtd::intptr
Gets the operating system handle for the xtd::net::sockets::socket.
auto blocking() const -> bool
Gets a value that indicates whether the xtd::net::sockets::socket is in blocking mode.
static auto os_supports_ip_v6() noexcept -> bool
Indicates whether the underlying operating system and network adaptors support Internet Protocol vers...
auto begin_receive(xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket.
auto protocol_type() const noexcept -> xtd::net::sockets::protocol_type
Gets the protocol type of the xtd::net::sockets::socket.
auto get_socket_multicast_option(xtd::net::sockets::socket_option_name socket_option_name) const -> xtd::net::sockets::multicast_option
Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::multicast_o...
auto equals(const socket &other) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto end_receive_message_from(xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_flags &socket_flags, xtd::sptr< xtd::net::end_point > &end_point, xtd::net::sockets::ip_packet_information &ip_packet_information) -> xtd::size
Ends a pending asynchronous read from a specific endpoint. This method also reveals more information ...
auto end_send(xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code) -> xtd::size
Ends a pending asynchronous send.
auto ttl() const -> xtd::byte
Gets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by th...
auto poll(xtd::int32 micro_seconds, xtd::net::sockets::select_mode mode) -> bool
Determines the status of the xtd::net::sockets::socket.
auto multicast_loopback() const -> bool
Gets a value that specifies whether outgoing multicast packets are delivered to the sending applicati...
auto available() const -> xtd::size
Gets the amount of data that has been received from the network and is available to be read.
auto send_timeout() const -> xtd::int32
Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::s...
auto begin_receive_from(xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins to asynchronously receive data from a specified network device.
auto listen(xtd::size backlog) -> void
Places a xtd::net::sockets::socket in a listening state.
auto begin_connect(const xtd::string &host, uint16 port, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins an asynchronous request for a remote host connection. The host is specified by a host name and...
auto dont_fragment() const -> bool
Gets a value that specifies whether the xtd::net::sockets::socket allows Internet Protocol (IP) datag...
auto begin_accept(xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins an asynchronous operation to accept an incoming connection attempt.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto get_socket_linger_option() const -> xtd::net::sockets::linger_option
Returns the linger xtd::net::sockets::socket option, represented as xtd::net::sockets::linger_option.
auto end_connect(xtd::sptr< xtd::iasync_result > async_result) -> void
Ends a pending asynchronous connection request.
auto end_send(xtd::sptr< xtd::iasync_result > async_result) -> xtd::size
Ends a pending asynchronous send.
auto send(const xtd::array< xtd::byte > &buffer) -> xtd::size
Sends data to a connected xtd::net::sockets::socket.
auto connect(const xtd::array< xtd::net::ip_address > &addresses, uint16 port) -> void
Establishes a connection to a remote host. The host is specified by an array of IP addresses and a po...
auto local_end_point() const -> xtd::sptr< xtd::net::end_point >
Gets the local endpoint.
auto begin_connect(const xtd::array< xtd::net::ip_address > &addresses, uint16 port, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip...
auto socket_type() const noexcept -> xtd::net::sockets::socket_type
Gets the type of the xtd::net::sockets::socket.
socket(const xtd::net::sockets::socket_information &socket_information)
Initializes a new instance of the xtd::net::sockets::socket class using the specified value returned ...
auto receive_buffer_size() const -> xtd::size
Gets a value that specifies the size of the receive buffer of the xtd::net::sockets::socket.
auto enable_broadcast() const -> bool
Gets a boolean value that specifies whether the xtd::net::sockets::socket can send or receive broadca...
auto accept() -> socket
Creates a new xtd::net::sockets::socket for a newly created connection.
static auto os_supports_ip_v4() noexcept -> bool
Indicates whether the underlying operating system and network adaptors support Internet Protocol vers...
auto begin_receive_message_from(xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins to asynchronously receive the specified number of bytes of data into the specified location of...
auto bind(const end_point_t &local_end_point) -> void
Associates a xtd::net::sockets::socket with a local endpoint.
Definition socket.hpp:801
auto begin_send_to(const xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size size, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Sends data asynchronously to a specific remote host.
auto connect(const xtd::net::ip_address &address, uint16 port) -> void
Establishes a connection to a remote host. The host is specified by an IP address and a port number.
auto send_buffer_size() const -> xtd::size
Gets a value that specifies the size of the send buffer of the xtd::net::sockets::socket.
auto close() -> void
Closes the xtd::net::sockets::socket connection and releases all associated resources.
socket()
Initializes a new instance of the xtd::net::sockets::socket class.
auto io_control(xtd::int32 io_control_code, xtd::array< xtd::byte > &option_in_value, xtd::array< xtd::byte > &option_out_value) -> xtd::size
Sets low-level operating modes for the xtd::net::sockets::socket using numerical control codes.
auto address_family() const noexcept -> xtd::net::sockets::address_family
Gets the address family of the xtd::net::sockets::socket.
auto end_accept(xtd::sptr< xtd::iasync_result > async_result) -> socket
Asynchronously accepts an incoming connection attempt and creates a new xtd::net::sockets::socket::so...
auto remote_end_point() const -> xtd::sptr< xtd::net::end_point >
Gets the remote endpoint.
auto connect(const xtd::string &host, uint16 port) -> void
Establishes a connection to a remote host. The host is specified by a host name and a port number.
auto exclusive_address_use() const -> bool
Gets a boolean value that specifies whether the xtd::net::sockets::socket allows only one process to ...
auto end_send_to(xtd::sptr< xtd::iasync_result > async_result) -> xtd::size
Ends a pending asynchronous send to a specific location.
auto set_socket_option(xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name, bool option_value) -> void
Sets the specified xtd::net::sockets::socket option to the specified integer value.
auto dual_mode() const -> bool
Gets a value that specifies whether the xtd::net::sockets::socket is a dual-mode socket used for both...
socket(xtd::net::sockets::socket_type socket_type, xtd::net::sockets::protocol_type protocol_type)
Initializes a new instance of the xtd::net::sockets::socket class using the specified socket type and...
auto shutdown(xtd::net::sockets::socket_shutdown how) -> void
Disables sends and receives on a xtd::net::sockets::socket.
auto connect(const end_point_t &remote_end_point) -> void
Establishes a connection to a remote host.
Definition socket.hpp:834
auto receive_from(xtd::array< xtd::byte > &buffer, xtd::net::end_point &remote_end_point) -> xtd::size
Receives data from a bound xtd::net::sockets::socket into a receive buffer.
auto end_receive_from(xtd::sptr< xtd::iasync_result > async_result, xtd::sptr< xtd::net::end_point > &end_point) -> xtd::size
Ends a pending asynchronous read from a specific endpoint.
auto is_bound() const noexcept -> bool
Gets a value that indicates whether the xtd::net::sockets::socket is bound to a specific local port.
auto compare_to(const socket &obj) const noexcept -> xtd::int32 override
Compares the current instance with another object of the same type.
auto receive_timeout() const -> xtd::int32
Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::r...
auto end_disconnect(xtd::sptr< xtd::iasync_result > async_result) -> void
Ends a pending asynchronous disconnect request.
auto begin_connect(const end_point_t &remote_end_point, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins an asynchronous request for a remote host connection.
Definition socket.hpp:584
auto begin_connect(const xtd::net::ip_address &address, uint16 port, xtd::async_callback callback, const xtd::any_object &state) -> xtd::sptr< xtd::iasync_result >
Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip...
auto disconnect(bool reuse_socket) -> void
Closes the socket connection and allows reuse of the socket.
auto get_socket_ip_v6_multicast_option(xtd::net::sockets::socket_option_name socket_option_name) const -> xtd::net::sockets::ip_v6_multicast_option
Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::ip_v6_multi...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Represents a thread synchronization event that, when signaled, must be reset manually....
Definition manual_reset_event.hpp:35
Encapsulates operating system specific objects that wait for exclusive access to shared resources.
Definition wait_handle.hpp:52
Contains core_export_ keyword.
Contains xtd::net::end_point class.
Contains xtd::collections::generic::ilist <type_t> interface.
xtd::delegate< void(async_result ar)> async_callback
References a method to be called when a corresponding asynchronous operation completes.
Definition delegate.hpp:39
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
xtd::sptr< xtd::iasync_result > async_result
Represents the status of an asynchronous operation.
Definition async_result.hpp:19
socket_error
Defines error codes for the xtd::net::sockets::socket class.
Definition socket_error.hpp:30
address_family
Specifies the addressing scheme that an instance of the xtd::net::sockets::socket class can use.
Definition address_family.hpp:30
socket_option_level
Defines socket option levels for the xtd::net::sockets::socket::set_socket_option and xtd::net::socke...
Definition socket_option_level.hpp:31
sptr< type_t > new_sptr(args_t &&... args)
xtd::new_sptr operator creates a xtd::sptr object.
Definition new_sptr.hpp:24
socket_option_name
Defines configuration option names.
Definition socket_option_name.hpp:31
ip_protection_level
A value that enables restriction of an IPv6 socket to a specified scope, such as addresses with the s...
Definition ip_protection_level.hpp:31
protocol_type
Specifies the protocols that the xtd::net::sockets::socket class supports.
Definition protocol_type.hpp:30
socket_flags
Specifies socket send and receive behaviors. This enumeration has a flags attribute that allows a bit...
Definition socket_flags.hpp:30
select_mode
Defines the polling modes for the xtd::net::sockets::socket::poll method.
Definition select_mode.hpp:31
socket_type
Specifies the type of socket that an instance of the xtd::net::sockets::socket class represents.
Definition socket_type.hpp:32
socket_shutdown
Defines constants that are used by the xtd::net::sockets::socket::shutdown method.
Definition socket_shutdown.hpp:31
io_control_code
Specifies the IO control codes supported by the xtd::net::sockets::socket::io_control method.
Definition io_control_code.hpp:30
@ success
Operation successful.
Definition socket_error.hpp:34
@ host
The xtd::uri::host data.
Definition uri_components.hpp:23
@ port
The xtd::uri::port data.
Definition uri_components.hpp:25
@ reuse_socket
The socket handle may be reused when the request completes. This flag is valid only if xtd::net::sock...
Definition transmit_file_options.hpp:38
@ error
Gets the error status and clear.
Definition socket_option_name.hpp:67
@ other
The operating system is other.
Definition platform_id.hpp:60
@ none
Use no flags for this call.
Definition socket_flags.hpp:32
@ e
The E key.
Definition console_key.hpp:96
Contains xtd::iasync_result interface.
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
Contains xtd::net::sockets::io_control_code enum.
Contains xtd::net::sockets::ip_protection_level enum.
Contains xtd::net::sockets::ip_v6_multicast_option class.
Contains xtd::net::sockets::linger_option class.
Contains xtd::threading::manual_reset_event exception.
Contains xtd::net::sockets::multicast_option class.
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd::net::sockets namespace provides a managed implementation of the Berkeley Sockets interface f...
Definition address_family.hpp:16
The xtd::net namespace provides a simple programming interface for many of the protocols used on netw...
Definition cookie_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::net::ip_address class.
Contains xtd::not_implemented_exception exception.
Contains xtd::not_supported_exception exception.
Contains xtd::object class.
Contains xtd::net::sockets::protocol_type enum.
Contains xtd::net::sockets::select_mode enum.
Contains xtd::net::sockets::socket_error enum.
Contains xtd::net::sockets::socket_flags enum.
Contains xtd::net::sockets::socket_option_level enum.
Contains xtd::net::sockets::socket_option_name enum.
Contains xtd::net::sockets::socket_shutdown enum.
Contains xtd::net::sockets::socket_type enum.
Contains xtd::string alias.
Contains xtd fundamental types.