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.
|
#include <socket.h>
Implements the Berkeley sockets interface.
Inherits xtd::object.
Public Member Functions | |
socket () | |
Initializes a new instance of the xtd::net::sockets::socket class. | |
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 from xtd::net::sockets::socket::duplicate_and_close. | |
socket (intptr_t handle) | |
Initializes a new instance of the xtd::net::sockets::socket class for the specified socket handle. | |
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 type and protocol. | |
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 protocol. If the operating system supports IPv6, this constructor creates a dual-mode socket; otherwise, it creates an IPv4 socket. | |
socket | accept () |
Creates a new xtd::net::sockets::socket for a newly created connection. | |
bool | accept_async (xtd::net::sockets::socket_async_event_args &e) |
Begins an asynchronous operation to accept an incoming connection attempt. | |
xtd::net::sockets::address_family | address_family () const noexcept |
Gets the address family of the xtd::net::sockets::socket. | |
size_t | available () const |
Gets the amount of data that has been received from the network and is available to be read. | |
std::shared_ptr< xtd::iasync_result > | begin_accept (xtd::async_callback callback, const std::any &state) |
Begins an asynchronous operation to accept an incoming connection attempt. | |
template<typename end_point_t > | |
std::shared_ptr< xtd::iasync_result > | begin_connect (const end_point_t &remote_end_point, xtd::async_callback callback, const std::any &state) |
Begins an asynchronous request for a remote host connection. | |
std::shared_ptr< xtd::iasync_result > | begin_connect (const std::vector< xtd::net::ip_address > &addresses, uint16_t port, xtd::async_callback callback, const std::any &state) |
Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip_address array and a port number. | |
std::shared_ptr< xtd::iasync_result > | begin_connect (const xtd::net::ip_address &address, uint16_t port, xtd::async_callback callback, const std::any &state) |
Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip_address and a port number. | |
std::shared_ptr< xtd::iasync_result > | begin_connect (const xtd::ustring &host, uint16_t port, xtd::async_callback callback, const std::any &state) |
Begins an asynchronous request for a remote host connection. The host is specified by a host name and a port number. | |
std::shared_ptr< xtd::iasync_result > | begin_disconnect (bool reuse_socket, xtd::async_callback callback, const std::any &state) |
Begins an asynchronous request to disconnect from a remote endpoint. | |
std::shared_ptr< xtd::iasync_result > | begin_receive (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::async_callback callback, const std::any &state) |
Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket. | |
std::shared_ptr< xtd::iasync_result > | begin_receive (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code, xtd::async_callback callback, const std::any &state) |
Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket. | |
std::shared_ptr< xtd::iasync_result > | begin_receive_from (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::async_callback callback, const std::any &state) |
Begins to asynchronously receive data from a specified network device. | |
std::shared_ptr< xtd::iasync_result > | begin_receive_message_from (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::async_callback callback, const std::any &state) |
Begins to asynchronously receive the specified number of bytes of data into the specified location of the data buffer, using the specified xtd::net::sockets::socket_flags, and stores the endpoint and packet information. | |
std::shared_ptr< xtd::iasync_result > | begin_send (const std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::async_callback callback, const std::any &state) |
Sends data asynchronously to a connected xtd::net::sockets::socket::socket. | |
std::shared_ptr< xtd::iasync_result > | begin_send (const std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code, xtd::async_callback callback, const std::any &state) |
Sends data asynchronously to a connected xtd::net::sockets::socket::socket. | |
std::shared_ptr< xtd::iasync_result > | begin_send_to (const std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point, xtd::async_callback callback, const std::any &state) |
Sends data asynchronously to a specific remote host. | |
template<typename end_point_t > | |
void | bind (const end_point_t &local_end_point) |
Associates a xtd::net::sockets::socket with a local endpoint. | |
bool | blocking () const |
Gets a value that indicates whether the xtd::net::sockets::socket is in blocking mode. | |
socket & | blocking (bool value) |
Sets a value that indicates whether the xtd::net::sockets::socket is in blocking mode. | |
void | close () |
Closes the xtd::net::sockets::socket connection and releases all associated resources. | |
template<typename end_point_t > | |
void | connect (const end_point_t &remote_end_point) |
Establishes a connection to a remote host. | |
void | connect (const std::vector< xtd::net::ip_address > &addresses, uint16_t port) |
Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number. | |
void | connect (const xtd::net::ip_address &address, uint16_t port) |
Establishes a connection to a remote host. The host is specified by an IP address and a port number. | |
void | connect (const xtd::ustring &host, uint16_t port) |
Establishes a connection to a remote host. The host is specified by a host name and a port number. | |
bool | connected () const noexcept |
Gets a value that indicates whether a xtd::net::sockets::socket is connected to a remote host as of the last xtd::net::sockets::socket::send or xtd::net::sockets::socket::receive operation. | |
void | disconnect (bool reuse_socket) |
Closes the socket connection and allows reuse of the socket. | |
bool | dont_fragment () const |
Gets a value that specifies whether the xtd::net::sockets::socket allows Internet Protocol (IP) datagrams to be fragmented. | |
socket & | dont_fragment (bool value) |
Sets a value that specifies whether the xtd::net::sockets::socket allows Internet Protocol (IP) datagrams to be fragmented. | |
bool | dual_mode () const |
Gets a value that specifies whether the xtd::net::sockets::socket is a dual-mode socket used for both IPv4 and IPv6. | |
socket & | dual_mode (bool value) |
Sets a value that specifies whether the xtd::net::sockets::socket is a dual-mode socket used for both IPv4 and IPv6. | |
bool | enable_broadcast () const |
Gets a boolean value that specifies whether the xtd::net::sockets::socket can send or receive broadcast packets. | |
socket & | enable_broadcast (bool value) |
Sets a bool value that specifies whether the xtd::net::sockets::socket can send or receive broadcast packets. | |
socket | end_accept (std::shared_ptr< xtd::iasync_result > async_result) |
Asynchronously accepts an incoming connection attempt and creates a new xtd::net::sockets::socket::socket to handle remote host communication. | |
void | end_connect (std::shared_ptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous connection request. | |
void | end_disconnect (std::shared_ptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous disconnect request. | |
size_t | end_receive (std::shared_ptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous read. | |
size_t | end_receive (std::shared_ptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code) |
Ends a pending asynchronous read. | |
size_t | end_receive_from (std::shared_ptr< xtd::iasync_result > async_result, std::shared_ptr< xtd::net::end_point > &end_point) |
Ends a pending asynchronous read from a specific endpoint. | |
size_t | end_receive_message_from (std::shared_ptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_flags &socket_flags, std::shared_ptr< xtd::net::end_point > &end_point, xtd::net::sockets::ip_packet_information &ip_packet_information) |
Ends a pending asynchronous read from a specific endpoint. This method also reveals more information about the packet than xtd::net::sockets::socket::end_receive_from(xtd::iasync_result, xtd::net::end_point). | |
size_t | end_send (std::shared_ptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous send. | |
size_t | end_send (std::shared_ptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code) |
Ends a pending asynchronous send. | |
size_t | end_send_to (std::shared_ptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous send to a specific location. | |
bool | exclusive_address_use () const |
Gets a boolean value that specifies whether the xtd::net::sockets::socket allows only one process to bind to a port. | |
socket & | exclusive_address_use (bool value) |
Gets a boolean value that specifies whether the xtd::net::sockets::socket allows only one process to bind to a port. | |
size_t | get_raw_socket_option (int32_t socket_option_level, int32_t socket_option_name, intptr_t option_value, size_t size_option_value) const |
Gets a socket option value using platform-specific level and name identifiers. | |
xtd::net::sockets::ip_v6_multicast_option | get_socket_ip_v6_multicast_option (xtd::net::sockets::socket_option_name socket_option_name) const |
Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::ip_v6_multicast_option. | |
xtd::net::sockets::linger_option | get_socket_linger_option () const |
Returns the linger xtd::net::sockets::socket option, represented as xtd::net::sockets::linger_option. | |
xtd::net::sockets::multicast_option | get_socket_multicast_option (xtd::net::sockets::socket_option_name socket_option_name) const |
Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::multicast_option. | |
int32_t | get_socket_option (xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name) const |
Returns the value of a specified xtd::net::sockets::socket option, represented as integer. | |
intptr_t | handle () const noexcept |
Gets the operating system handle for the xtd::net::sockets::socket. | |
size_t | io_control (int32_t io_control_code, std::vector< uint8_t > &option_in_value, std::vector< uint8_t > &option_out_value) |
Sets low-level operating modes for the xtd::net::sockets::socket using numerical control codes. | |
size_t | io_control (xtd::net::sockets::io_control_code io_control_code, std::vector< uint8_t > &option_in_value, std::vector< uint8_t > &option_out_value) |
Sets low-level operating modes for the xtd::net::sockets::socket using xtd::net::sockets::io_control_code control codes. | |
bool | is_bound () const noexcept |
Gets a value that indicates whether the xtd::net::sockets::socket is bound to a specific local port. | |
xtd::net::sockets::linger_option | linger_state () const |
Gets a value that specifies whether the xtd::net::sockets::socket will delay closing a socket in an attempt to send all pending data. | |
socket & | linger_state (const xtd::net::sockets::linger_option &value) |
Sets a value that specifies whether the xtd::net::sockets::socket will delay closing a socket in an attempt to send all pending data. | |
void | listen () |
Places a xtd::net::sockets::socket in a listening state. | |
void | listen (size_t backlog) |
Places a xtd::net::sockets::socket in a listening state. | |
std::shared_ptr< xtd::net::end_point > | local_end_point () const |
Gets the local endpoint. | |
bool | multicast_loopback () const |
Gets a value that specifies whether outgoing multicast packets are delivered to the sending application. | |
socket & | multicast_loopback (bool value) |
Sets a value that specifies whether outgoing multicast packets are delivered to the sending application. | |
bool | no_delay () const |
Gets a boolean value that specifies whether the stream xtd::net::sockets::socket is using the Nagle algorithm. | |
socket & | no_delay (bool value) |
Gets a boolean value that specifies whether the stream xtd::net::sockets::socket is using the Nagle algorithm. | |
bool | poll (int32_t micro_seconds, xtd::net::sockets::select_mode mode) |
Determines the status of the xtd::net::sockets::socket. | |
xtd::net::sockets::protocol_type | protocol_type () const noexcept |
Gets the protocol type of the xtd::net::sockets::socket. | |
size_t | receive (std::vector< byte_t > &buffer) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer. | |
size_t | receive (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags) |
Receives the specified number of bytes from a bound xtd::net::sockets::socket into the specified offset position of the receive buffer, using the specified xtd::net::sockets::socket_flags. | |
size_t | receive (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error) |
Receives the specified number of bytes from a bound xtd::net::sockets::socket into the specified offset position of the receive buffer, using the specified xtd::net::sockets::socket_flags. | |
size_t | receive (std::vector< byte_t > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags) |
Receives the specified number of bytes of data from a bound xtd::net::sockets::socket into a receive buffer, using the specified xtd::net::sockets::socket_flags. | |
size_t | receive (std::vector< byte_t > &buffer, xtd::net::sockets::socket_flags socket_flags) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer, using the specified xtd::net::sockets::socket_flags. | |
size_t | receive_buffer_size () const |
Gets a value that specifies the size of the receive buffer of the xtd::net::sockets::socket. | |
socket & | receive_buffer_size (size_t value) |
Sets a value that specifies the size of the receive buffer of the xtd::net::sockets::socket. | |
size_t | receive_from (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer. | |
size_t | receive_from (std::vector< byte_t > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer. | |
size_t | receive_from (std::vector< byte_t > &buffer, xtd::net::end_point &remote_end_point) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer. | |
size_t | receive_from (std::vector< byte_t > &buffer, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer. | |
size_t | receive_message_from (std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::net::sockets::ip_packet_information &ip_packet_information) |
int32_t | receive_timeout () const |
Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::receive call will time out. | |
socket & | receive_timeout (int32_t value) |
Sets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::receive call will time out. | |
std::shared_ptr< xtd::net::end_point > | remote_end_point () const |
Gets the remote endpoint. | |
size_t | send (const std::vector< byte_t > &buffer) |
Sends data to a connected xtd::net::sockets::socket. | |
size_t | send (const std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags) |
Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, starting at the specified offset, and using the specified xtd::net::sockets::socket_flags. | |
size_t | send (const std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code) |
Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, starting at the specified offset, and using the specified xtd::net::sockets::socket_flags. | |
size_t | send (const std::vector< byte_t > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags) |
Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, using the specified xtd::net::sockets::socket_flags. | |
size_t | send (const std::vector< byte_t > &buffer, xtd::net::sockets::socket_flags socket_flags) |
Sends data to a connected xtd::net::sockets::socket using the specified xtd::net::sockets::socket_flags. | |
size_t | send_buffer_size () const |
Gets a value that specifies the size of the send buffer of the xtd::net::sockets::socket. | |
socket & | send_buffer_size (size_t value) |
Sets a value that specifies the size of the send buffer of the xtd::net::sockets::socket. | |
int32_t | send_timeout () const |
Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::send call will time out. | |
socket & | send_timeout (int32_t value) |
Sets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::send call will time out. | |
size_t | send_to (const std::vector< byte_t > &buffer, const xtd::net::end_point &remote_end_point) |
Sends data to the specified endpoint. | |
size_t | send_to (const std::vector< byte_t > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point) |
Sends the specified number of bytes of data to the specified endpoint, starting at the specified location in the buffer, and using the specified xtd::net::sockets::socket_flags. | |
size_t | send_to (const std::vector< byte_t > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point) |
Sends the specified number of bytes of data to the specified endpoint using the specified xtd::net::sockets::socket_flags. | |
size_t | send_to (const std::vector< byte_t > &buffer, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point) |
Sends data to a specific endpoint using the specified xtd::net::sockets::socket_flags. | |
void | set_ip_protection_level (xtd::net::sockets::ip_protection_level level) |
Sets the IP protection level on a socket. | |
void | set_raw_socket_option (int32_t socket_option_level, int32_t socket_option_name, intptr_t option_value, size_t option_value_size) |
Sets a socket option value using platform-specific level and name identifiers. | |
void | set_socket_option (xtd::net::sockets::linger_option option_value) |
Sets the linger xtd::net::sockets::socket option to the specified integer value. | |
void | set_socket_option (xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name, bool option_value) |
Sets the specified xtd::net::sockets::socket option to the specified integer value. | |
void | set_socket_option (xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name, int32_t option_value) |
Sets the specified xtd::net::sockets::socket option to the specified integer value. | |
void | set_socket_option (xtd::net::sockets::socket_option_name socket_option_name, xtd::net::sockets::ip_v6_multicast_option option_value) |
Sets the linger xtd::net::sockets::socket option to the specified integer value. | |
void | set_socket_option (xtd::net::sockets::socket_option_name socket_option_name, xtd::net::sockets::multicast_option option_value) |
Sets the linger xtd::net::sockets::socket option to the specified integer value. | |
void | shutdown (xtd::net::sockets::socket_shutdown how) |
Disables sends and receives on a xtd::net::sockets::socket. | |
xtd::net::sockets::socket_type | socket_type () const noexcept |
Gets the type of the xtd::net::sockets::socket. | |
byte_t | ttl () const |
Gets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::socket. | |
socket & | ttl (byte_t value) |
Sets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::socket. | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. | |
virtual xtd::ustring | to_string () const noexcept |
Returns a std::string that represents the current object. | |
Static Public Member Functions | |
static bool | os_supports_ip_v4 () noexcept |
Indicates whether the underlying operating system and network adaptors support Internet Protocol version 4 (IPv4). | |
static bool | os_supports_ip_v6 () noexcept |
Indicates whether the underlying operating system and network adaptors support Internet Protocol version 6 (IPv6). | |
static size_t | select (std::vector< socket > &check_read, std::vector< socket > &check_write, std::vector< socket > &check_error, int32_t microseconds) |
Determines the status of one or more sockets. | |
Static Public Member Functions inherited from xtd::object | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
xtd::net::sockets::socket::socket | ( | ) |
Initializes a new instance of the xtd::net::sockets::socket class.
xtd::net::sockets::socket::socket | ( | intptr_t | handle | ) |
Initializes a new instance of the xtd::net::sockets::socket class for the specified socket handle.
handle | The socket handle for the socket that the xtd::net::sockets::socket object will encapsulate. |
xtd::argument_exception | The handle is invalid. |
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 from xtd::net::sockets::socket::duplicate_and_close.
socket_information | The socket information returned by xtd::net::sockets::socket::duplicate_and_close. |
xtd::net::sockets::socket::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 protocol. If the operating system supports IPv6, this constructor creates a dual-mode socket; otherwise, it creates an IPv4 socket.
socket_type | One of the xtd::net::sockets::socket_type values. |
protocol_type | One of the xtd::net::sockets::protocol_type values. |
xtd::net:sockets::socket_exception | The combination of socket_type and protocol_type results in an invalid socket. |
xtd::net::sockets::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 type and protocol.
address_family | One of the xtd::net::sockets::address_family values. |
socket_type | One of the xtd::net::sockets::socket_type values. |
protocol_type | One of the xtd::net::sockets::protocol_type values. |
xtd::net:sockets::socket_exception | The combination of address_family, socket_type and protocol_type results in an invalid socket. |
socket xtd::net::sockets::socket::accept | ( | ) |
Creates a new xtd::net::sockets::socket for a newly created connection.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
bool xtd::net::sockets::socket::accept_async | ( | xtd::net::sockets::socket_async_event_args & | e | ) |
Begins an asynchronous operation to accept an incoming connection attempt.
e | The xtd::net::sockets::socket::socket_async_event_args object to use for this asynchronous socket operation. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::argument_exception | An argument is not valid. This exception occurs if the buffer provided is not large enough. The buffer must be at least 2 * (sizeof(SOCKADDR_STORAGE + 16) bytes. This exception also occurs if multiple buffers are specified, the xtd::net::sockets::socket_async_event_args::buffer_list property is not empty. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
|
noexcept |
Gets the address family of the xtd::net::sockets::socket.
size_t xtd::net::sockets::socket::available | ( | ) | const |
Gets the amount of data that has been received from the network and is available to be read.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_accept | ( | xtd::async_callback | callback, |
const std::any & | state | ||
) |
Begins an asynchronous operation to accept an incoming connection attempt.
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
|
inline |
Begins an asynchronous request for a remote host connection.
remote_end_point | An xtd::net::end_point that represents the remote host. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_connect | ( | const std::vector< xtd::net::ip_address > & | addresses, |
uint16_t | port, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip_address array and a port number.
addresses | At least one xtd::net::ip_address, designating the remote host. |
port | The port number of the remote host. |
callback | An xtd::async_callback delegate that references the method to invoke when the connect operation is complete. |
state | A user-defined object that contains information about the connect operation. This object is passed to the requestCallback delegate when the operation is complete. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_connect | ( | const xtd::net::ip_address & | address, |
uint16_t | port, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip_address and a port number.
address | The xtd::net::ip_address of the remote host. |
port | The port number of the remote host. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_connect | ( | const xtd::ustring & | host, |
uint16_t | port, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins an asynchronous request for a remote host connection. The host is specified by a host name and a port number.
host | The name of the remote host. |
port | The port number of the remote host. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_disconnect | ( | bool | reuse_socket, |
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins an asynchronous request to disconnect from a remote endpoint.
reuse_socket | true if this socket can be reused after the connection is closed; otherwise, false. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive | ( | std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket.
buffer | An array of type byte_t that is the storage location for the received data. |
offset | The zero-based position in the buffer parameter at which to store the received data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive | ( | std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::sockets::socket_error & | error_code, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket.
buffer | An array of type byte_t that is the storage location for the received data. |
offset | The zero-based position in the buffer parameter at which to store the received data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
error_code | A xtd::net::sockets::socket_error object that stores the socket error. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive_from | ( | std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::end_point & | remote_end_point, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins to asynchronously receive data from a specified network device.
buffer | An array of type byte_t that is the storage location for the received data. |
offset | The zero-based position in the buffer parameter at which to store the data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | An xtd::net::end_point that represents the source of the data. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive_message_from | ( | std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::end_point & | remote_end_point, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Begins to asynchronously receive the specified number of bytes of data into the specified location of the data buffer, using the specified xtd::net::sockets::socket_flags, and stores the endpoint and packet information.
buffer | An array of type byte_t that is the storage location for the received data. |
offset | The zero-based position in the buffer parameter at which to store the data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | An xtd::net::end_point that represents the source of the data. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_send | ( | const std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Sends data asynchronously to a connected xtd::net::sockets::socket::socket.
buffer | An array of type byte_t that contains the data to send. |
offset | The zero-based position in the buffer parameter at which to begin sending data. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_send | ( | const std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::sockets::socket_error & | error_code, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Sends data asynchronously to a connected xtd::net::sockets::socket::socket.
buffer | An array of type byte_t that contains the data to send. |
offset | The zero-based position in the buffer parameter at which to begin sending data. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
error_code | A xtd::net::sockets::socket_error object that stores the socket error. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
std::shared_ptr< xtd::iasync_result > xtd::net::sockets::socket::begin_send_to | ( | const std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
const xtd::net::end_point & | remote_end_point, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
Sends data asynchronously to a specific remote host.
buffer | An array of type byte_t that contains the data to send. |
offset | The zero-based position in buffer at which to begin sending data. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | An xtd::net::end_point that represents the remote device. |
callback | The xtd::async_callback delegate. |
state | An object that contains state information for this request. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | The accepting socket is not listening for connections. You must call xtd::net::sockets::socket::bind and xtd::net::sockets::socket::listen before calling xtd::net::sockets::socket::accept(). |
|
inline |
Associates a xtd::net::sockets::socket with a local endpoint.
localEndPoint | The local xtd::net::sockets::end_point to associate with the xtd::net::sockets::socket. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::socket::blocking | ( | ) | const |
Gets a value that indicates whether the xtd::net::sockets::socket is in blocking mode.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::blocking | ( | bool | value | ) |
Sets a value that indicates whether the xtd::net::sockets::socket is in blocking mode.
value | true if the xtd::net::sockets::socket will block; otherwise, false. The default is true. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::close | ( | ) |
Closes the xtd::net::sockets::socket connection and releases all associated resources.
|
inline |
Establishes a connection to a remote host.
remote_end_point | An xtd::net::end_point that represents the remote device. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::connect | ( | const std::vector< xtd::net::ip_address > & | addresses, |
uint16_t | port | ||
) |
Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number.
addresses | The IP addresses of the remote host. |
port | The port number of the remote host. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::connect | ( | const xtd::net::ip_address & | address, |
uint16_t | port | ||
) |
Establishes a connection to a remote host. The host is specified by an IP address and a port number.
address | The IP address of the remote host. |
port | The port number of the remote host. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::connect | ( | const xtd::ustring & | host, |
uint16_t | port | ||
) |
Establishes a connection to a remote host. The host is specified by a host name and a port number.
host | The name of the remote host. |
port | The port number of the remote host. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
|
noexcept |
Gets a value that indicates whether a xtd::net::sockets::socket is connected to a remote host as of the last xtd::net::sockets::socket::send or xtd::net::sockets::socket::receive operation.
void xtd::net::sockets::socket::disconnect | ( | bool | reuse_socket | ) |
Closes the socket connection and allows reuse of the socket.
reuse_socket | true if this socket can be reused after the current connection is closed; otherwise, false. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::socket::dont_fragment | ( | ) | const |
Gets a value that specifies whether the xtd::net::sockets::socket allows Internet Protocol (IP) datagrams to be fragmented.
xtd::not_supported_exception | The socket is not in the xtd::net::sockets::address_family::inter_network family. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::dont_fragment | ( | bool | value | ) |
Sets a value that specifies whether the xtd::net::sockets::socket allows Internet Protocol (IP) datagrams to be fragmented.
value | true if the xtd::net::sockets::socket doesn't allow datagram fragmentation; otherwise, false. The default is true. |
xtd::not_supported_exception | The socket is not in the xtd::net::sockets::address_family::inter_network family. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::socket::dual_mode | ( | ) | const |
Gets a value that specifies whether the xtd::net::sockets::socket is a dual-mode socket used for both IPv4 and IPv6.
xtd::not_supported_exception | The socket is not in the xtd::net::sockets::address_family::inter_network_v6 family. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::dual_mode | ( | bool | value | ) |
Sets a value that specifies whether the xtd::net::sockets::socket is a dual-mode socket used for both IPv4 and IPv6.
value | true if the xtd::net::sockets::socket is a dual-mode socket; otherwise, false. The default is true if the socket was created by calling the xtd::net::sockets::socket(xtd::net::sockets::socket_type, xtd::net::sockets::protocol_type) constructor and the operating system supports IPv6; otherwise, the default is false. |
xtd::not_supported_exception | The socket is not in the xtd::net::sockets::address_family::inter_network_v6 family. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::socket::enable_broadcast | ( | ) | const |
Gets a boolean value that specifies whether the xtd::net::sockets::socket can send or receive broadcast packets.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::enable_broadcast | ( | bool | value | ) |
Sets a bool value that specifies whether the xtd::net::sockets::socket can send or receive broadcast packets.
value | true if the xtd::net::sockets::socket allows broadcast packets; otherwise, false. The default is false. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket xtd::net::sockets::socket::end_accept | ( | std::shared_ptr< xtd::iasync_result > | async_result | ) |
Asynchronously accepts an incoming connection attempt and creates a new xtd::net::sockets::socket::socket to handle remote host communication.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::end_connect | ( | std::shared_ptr< xtd::iasync_result > | async_result | ) |
Ends a pending asynchronous connection request.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_connect method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::end_disconnect | ( | std::shared_ptr< xtd::iasync_result > | async_result | ) |
Ends a pending asynchronous disconnect request.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_disconnect method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::end_receive | ( | std::shared_ptr< xtd::iasync_result > | async_result | ) |
Ends a pending asynchronous read.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_receive method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::end_receive | ( | std::shared_ptr< xtd::iasync_result > | async_result, |
xtd::net::sockets::socket_error & | error_code | ||
) |
Ends a pending asynchronous read.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
error_code | A xtd::net::sockets::socket_error object that stores the socket error. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_receive method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::end_receive_from | ( | std::shared_ptr< xtd::iasync_result > | async_result, |
std::shared_ptr< xtd::net::end_point > & | end_point | ||
) |
Ends a pending asynchronous read from a specific endpoint.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
end_point | The source xtd::net::end_point. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_receive_from method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::end_receive_message_from | ( | std::shared_ptr< xtd::iasync_result > | async_result, |
xtd::net::sockets::socket_flags & | socket_flags, | ||
std::shared_ptr< xtd::net::end_point > & | end_point, | ||
xtd::net::sockets::ip_packet_information & | ip_packet_information | ||
) |
Ends a pending asynchronous read from a specific endpoint. This method also reveals more information about the packet than xtd::net::sockets::socket::end_receive_from(xtd::iasync_result, xtd::net::end_point).
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values for the received packet. |
end_point | The source xtd::net::end_point. |
ip_packet_information | The xtd::net::ip_address and interface of the received packet. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_receive_message_from method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::end_send | ( | std::shared_ptr< xtd::iasync_result > | async_result | ) |
Ends a pending asynchronous send.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_send method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::end_send | ( | std::shared_ptr< xtd::iasync_result > | async_result, |
xtd::net::sockets::socket_error & | error_code | ||
) |
Ends a pending asynchronous send.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
error_code | A xtd::net::sockets::socket_error object that stores the socket error. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_send method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::end_send_to | ( | std::shared_ptr< xtd::iasync_result > | async_result | ) |
Ends a pending asynchronous send to a specific location.
async_result | An xtd::iasync_result that stores state information for this asynchronous operation as well as any user defined data. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::socket::begin_send_to method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::socket::exclusive_address_use | ( | ) | const |
Gets a boolean value that specifies whether the xtd::net::sockets::socket allows only one process to bind to a port.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::exclusive_address_use | ( | bool | value | ) |
Gets a boolean value that specifies whether the xtd::net::sockets::socket allows only one process to bind to a port.
value | true if the xtd::net::sockets::socket allows only one socket to bind to a specific port; otherwise, false. The default is true for Windows Server 2003 and Windows XP Service Pack 2, and false for all other versions. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::invalid_operation_exception | xtd::net::sockets::socket::bind has been called for this xtd::net::sockets::socket. |
size_t xtd::net::sockets::socket::get_raw_socket_option | ( | int32_t | socket_option_level, |
int32_t | socket_option_name, | ||
intptr_t | option_value, | ||
size_t | size_option_value | ||
) | const |
Gets a socket option value using platform-specific level and name identifiers.
socket_option_level | The platform-defined option level. |
socket_option_name | The platform-defined option name. |
option_value | The pointer into which the retrieved option value should be stored. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::net::sockets::ip_v6_multicast_option xtd::net::sockets::socket::get_socket_ip_v6_multicast_option | ( | xtd::net::sockets::socket_option_name | socket_option_name | ) | const |
Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::ip_v6_multicast_option.
socket_option_name | One of the xtd::net::sockets::socket_option_name values. Only xtd::net::sockets::socket_option_name::add_membership and xtd::net::sockets::socket_option_name::drop_membership values are accepted. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::net::sockets::linger_option xtd::net::sockets::socket::get_socket_linger_option | ( | ) | const |
Returns the linger xtd::net::sockets::socket option, represented as xtd::net::sockets::linger_option.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::net::sockets::multicast_option xtd::net::sockets::socket::get_socket_multicast_option | ( | xtd::net::sockets::socket_option_name | socket_option_name | ) | const |
Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::multicast_option.
socket_option_name | One of the xtd::net::sockets::socket_option_name values. Only xtd::net::sockets::socket_option_name::add_membership and xtd::net::sockets::socket_option_name::drop_membership values are accepted. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
int32_t xtd::net::sockets::socket::get_socket_option | ( | xtd::net::sockets::socket_option_level | socket_option_level, |
xtd::net::sockets::socket_option_name | socket_option_name | ||
) | const |
Returns the value of a specified xtd::net::sockets::socket option, represented as integer.
socket_option_level | One of the xtd::net::sockets::socket_option_level values. |
socket_option_name | One of the xtd::net::sockets::socket_option_name values. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
|
noexcept |
Gets the operating system handle for the xtd::net::sockets::socket.
size_t xtd::net::sockets::socket::io_control | ( | int32_t | io_control_code, |
std::vector< uint8_t > & | option_in_value, | ||
std::vector< uint8_t > & | option_out_value | ||
) |
Sets low-level operating modes for the xtd::net::sockets::socket using numerical control codes.
io_control_code | An int32_t value that specifies the control code of the operation to perform. |
option_in_value | A byte array that contains the input data required by the operation. |
option_out_value | A byte array that contains the output data returned by the operation. |
size_t xtd::net::sockets::socket::io_control | ( | xtd::net::sockets::io_control_code | io_control_code, |
std::vector< uint8_t > & | option_in_value, | ||
std::vector< uint8_t > & | option_out_value | ||
) |
Sets low-level operating modes for the xtd::net::sockets::socket using xtd::net::sockets::io_control_code control codes.
io_control_code | A xtd::net::sockets::io_control_code value that specifies the control code of the operation to perform. |
option_in_value | A byte array that contains the input data required by the operation. |
option_out_value | A byte array that contains the output data returned by the operation. |
|
noexcept |
Gets a value that indicates whether the xtd::net::sockets::socket is bound to a specific local port.
xtd::net::sockets::linger_option xtd::net::sockets::socket::linger_state | ( | ) | const |
Gets a value that specifies whether the xtd::net::sockets::socket will delay closing a socket in an attempt to send all pending data.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::net::sockets::linger_state::enabled | xtd::net::sockets::linger_state::linger_time | Behavior |
---|---|---|
false (disabled), the default value | The time-out is not applicable, (default). | Attempts to send pending data until the default IP protocol time-out expires. |
true (enabled) | A nonzero time-out. | Attempts to send pending data until the specified time-out expires, and if the attempt fails, then Winsock resets the connection. |
true (enabled) | Â A zero time-out. | Discards any pending data. For connection-oriented socket (TCP, for example), Winsock resets the connection. |
socket & xtd::net::sockets::socket::linger_state | ( | const xtd::net::sockets::linger_option & | value | ) |
Sets a value that specifies whether the xtd::net::sockets::socket will delay closing a socket in an attempt to send all pending data.
value | A xtd::net::sockets::sockets::linger_option that specifies how to linger while closing a socket. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::net::sockets::linger_state::enabled | xtd::net::sockets::linger_state::linger_time | Behavior |
---|---|---|
false (disabled), the default value | The time-out is not applicable, (default). | Attempts to send pending data until the default IP protocol time-out expires. |
true (enabled) | A nonzero time-out. | Attempts to send pending data until the specified time-out expires, and if the attempt fails, then Winsock resets the connection. |
true (enabled) | Â A zero time-out. | Discards any pending data. For connection-oriented socket (TCP, for example), Winsock resets the connection. |
void xtd::net::sockets::socket::listen | ( | ) |
Places a xtd::net::sockets::socket in a listening state.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::listen | ( | size_t | backlog | ) |
Places a xtd::net::sockets::socket in a listening state.
backlog | The maximum length of the pending connections queue. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
std::shared_ptr< xtd::net::end_point > xtd::net::sockets::socket::local_end_point | ( | ) | const |
Gets the local endpoint.
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::socket::multicast_loopback | ( | ) | const |
Gets a value that specifies whether outgoing multicast packets are delivered to the sending application.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::not_supported_exception | The xtd::net::sockets::socket is not in the xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6 families. |
socket & xtd::net::sockets::socket::multicast_loopback | ( | bool | value | ) |
Sets a value that specifies whether outgoing multicast packets are delivered to the sending application.
value | true if the xtd::net::sockets::socket receives outgoing multicast packets; otherwise, false. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::not_supported_exception | The xtd::net::sockets::socket is not in the xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6 families. |
bool xtd::net::sockets::socket::no_delay | ( | ) | const |
Gets a boolean value that specifies whether the stream xtd::net::sockets::socket is using the Nagle algorithm.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::no_delay | ( | bool | value | ) |
Gets a boolean value that specifies whether the stream xtd::net::sockets::socket is using the Nagle algorithm.
value | false if the xtd::net::sockets::socket uses the Nagle algorithm; otherwise, true. The default is false. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
|
staticnoexcept |
Indicates whether the underlying operating system and network adaptors support Internet Protocol version 4 (IPv4).
|
staticnoexcept |
Indicates whether the underlying operating system and network adaptors support Internet Protocol version 6 (IPv6).
bool xtd::net::sockets::socket::poll | ( | int32_t | micro_seconds, |
xtd::net::sockets::select_mode | mode | ||
) |
Determines the status of the xtd::net::sockets::socket.
micro_seconds | The time to wait for a response, in microseconds. |
mode | One of the xtd::net::sockets::select_mode values. |
Mode | Return Value |
---|---|
xtd::net::sockets::select_mode::select_read | true if xtd::net::sockets::socket::listen has been called and a connection is pending; -or- true if data is available for reading; -or- true if the connection has been closed, reset, or terminated; otherwise, returns false. |
xtd::net::sockets::select_mode::select_write | true, if processing a xtd::net::sockets::socket::connect, and the connection has succeeded; -or- true if data can be sent; otherwise, returns false. |
xtd::net::sockets::select_mode::select_error | true if processing a xtd::net::sockets::socket::connect that does not block, and the connection has failed; -or- true if xtd::net::sockets::socket_option_name::out_of_band_inline is not set and out-of-band data is available; otherwise, returns false. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
|
noexcept |
Gets the protocol type of the xtd::net::sockets::socket.
size_t xtd::net::sockets::socket::receive | ( | std::vector< byte_t > & | buffer | ) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer.
buffer | An array of type byte that is the storage location for the received data. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive | ( | std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags | ||
) |
Receives the specified number of bytes from a bound xtd::net::sockets::socket into the specified offset position of the receive buffer, using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that is the storage location for the received data. |
offset | The location in buffer to store the received data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive | ( | std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::sockets::socket_error & | error | ||
) |
Receives the specified number of bytes from a bound xtd::net::sockets::socket into the specified offset position of the receive buffer, using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that is the storage location for the received data. |
offset | The location in buffer to store the received data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
error_code | A xtd::net::sockets::socket_error object that stores the socket error. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive | ( | std::vector< byte_t > & | buffer, |
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags | ||
) |
Receives the specified number of bytes of data from a bound xtd::net::sockets::socket into a receive buffer, using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that is the storage location for the received data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive | ( | std::vector< byte_t > & | buffer, |
xtd::net::sockets::socket_flags | socket_flags | ||
) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer, using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that is the storage location for the received data. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive_buffer_size | ( | ) | const |
Gets a value that specifies the size of the receive buffer of the xtd::net::sockets::socket.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::receive_buffer_size | ( | size_t | value | ) |
Sets a value that specifies the size of the receive buffer of the xtd::net::sockets::socket.
value | An size_t that contains the size, in bytes, of the receive buffer. The default is 8192. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive_from | ( | std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::end_point & | remote_end_point | ||
) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer.
buffer | An array of type byte that is the storage location for the received data. |
offset | The position in the buffer parameter to store the received data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | the remote host |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive_from | ( | std::vector< byte_t > & | buffer, |
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::end_point & | remote_end_point | ||
) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer.
buffer | An array of type byte that is the storage location for the received data. |
size | The number of bytes to receive. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | the remote host |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive_from | ( | std::vector< byte_t > & | buffer, |
xtd::net::end_point & | remote_end_point | ||
) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer.
buffer | An array of type byte that is the storage location for the received data. |
remote_end_point | the remote host |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::receive_from | ( | std::vector< byte_t > & | buffer, |
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::end_point & | remote_end_point | ||
) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer.
buffer | An array of type byte that is the storage location for the received data. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | the remote host |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
int32_t xtd::net::sockets::socket::receive_timeout | ( | ) | const |
Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::receive call will time out.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::receive_timeout | ( | int32_t | value | ) |
Sets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::receive call will time out.
value | The time-out value, in milliseconds. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::argument_out_of_range_exception | The value specified for a set operation is less than -1. |
std::shared_ptr< xtd::net::end_point > xtd::net::sockets::socket::remote_end_point | ( | ) | const |
Gets the remote endpoint.
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
|
static |
Determines the status of one or more sockets.
check_read | An array of xtd::net::sockets::socket instances to check for readability. |
check_write | An array of xtd::net::sockets::socket instances to check for writability. |
check_error | An array of xtd::net::sockets::socket instances to check for errors. |
microseconds | The time-out value, in microseconds. A -1 value indicates an infinite time-out. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
size_t xtd::net::sockets::socket::send | ( | const std::vector< byte_t > & | buffer | ) |
Sends data to a connected xtd::net::sockets::socket.
buffer | An array of type byte that contains the data to be sent. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send | ( | const std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags | ||
) |
Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, starting at the specified offset, and using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that contains the data to be sent. |
offset | The position in the data buffer at which to begin sending data. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send | ( | const std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
xtd::net::sockets::socket_error & | error_code | ||
) |
Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, starting at the specified offset, and using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that contains the data to be sent. |
offset | The position in the data buffer at which to begin sending data. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
error_code | A xtd::net::sockets::socket_error object that stores the socket error. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send | ( | const std::vector< byte_t > & | buffer, |
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags | ||
) |
Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that contains the data to be sent. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send | ( | const std::vector< byte_t > & | buffer, |
xtd::net::sockets::socket_flags | socket_flags | ||
) |
Sends data to a connected xtd::net::sockets::socket using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that contains the data to be sent. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send_buffer_size | ( | ) | const |
Gets a value that specifies the size of the send buffer of the xtd::net::sockets::socket.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::send_buffer_size | ( | size_t | value | ) |
Sets a value that specifies the size of the send buffer of the xtd::net::sockets::socket.
value | An size_t that contains the size, in bytes, of the send buffer. The default is 8192. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
int32_t xtd::net::sockets::socket::send_timeout | ( | ) | const |
Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::send call will time out.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
socket & xtd::net::sockets::socket::send_timeout | ( | int32_t | value | ) |
Sets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::send call will time out.
value | The time-out value, in milliseconds. If you set the property with a value between 1 and 499, the value will be changed to 500. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::argument_out_of_range_exception | The value specified for a set operation is less than -1. |
size_t xtd::net::sockets::socket::send_to | ( | const std::vector< byte_t > & | buffer, |
const xtd::net::end_point & | remote_end_point | ||
) |
Sends data to the specified endpoint.
buffer | An array of type byte that contains the data to be sent. |
remote_end_point | The xtd::net::end_point that represents the destination for the data. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send_to | ( | const std::vector< byte_t > & | buffer, |
size_t | offset, | ||
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
const xtd::net::end_point & | remote_end_point | ||
) |
Sends the specified number of bytes of data to the specified endpoint, starting at the specified location in the buffer, and using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that contains the data to be sent. |
offset | The position in the data buffer at which to begin sending data. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | The xtd::net::end_point that represents the destination for the data. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send_to | ( | const std::vector< byte_t > & | buffer, |
size_t | size, | ||
xtd::net::sockets::socket_flags | socket_flags, | ||
const xtd::net::end_point & | remote_end_point | ||
) |
Sends the specified number of bytes of data to the specified endpoint using the specified xtd::net::sockets::socket_flags.
buffer | An array of type byte that contains the data to be sent. |
size | The number of bytes to send. |
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
remote_end_point | The xtd::net::end_point that represents the destination for the data. |
xtd::argument_out_of_range_exception | size is less than 0 or exceeds the size of the buffer. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::socket::send_to | ( | const std::vector< byte_t > & | buffer, |
xtd::net::sockets::socket_flags | socket_flags, | ||
const xtd::net::end_point & | remote_end_point | ||
) |
Sends data to a specific endpoint using the specified xtd::net::sockets::socket_flags.
socket_flags | A bitwise combination of the xtd::net::sockets::socket_flags values. |
buffer | An array of type byte that contains the data to be sent. |
remote_end_point | The xtd::net::end_point that represents the destination for the data. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::set_ip_protection_level | ( | xtd::net::sockets::ip_protection_level | level | ) |
Sets the IP protection level on a socket.
level | The IP protection level to set on this socket.The IP protection level to set on this socket. |
xtd::argument_exception | The level argument is set to xtd::net::sockets::ip_protection_level::unspecified. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::not_supported_exception | The socket is not in the xtd::net::sockets::address_family::inter_network_v6 or xtd::net::sockets::address_family::inter_network address families. |
void xtd::net::sockets::socket::set_raw_socket_option | ( | int32_t | socket_option_level, |
int32_t | socket_option_name, | ||
intptr_t | option_value, | ||
size_t | option_value_size | ||
) |
Sets a socket option value using platform-specific level and name identifiers.
socket_option_level | The platform-defined option name. |
socket_option_name | The platform-defined option name. |
option_value | A pointer of the option value. |
size_option_value | The size of the option value. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::set_socket_option | ( | xtd::net::sockets::linger_option | option_value | ) |
Sets the linger xtd::net::sockets::socket option to the specified integer value.
option_value | A value of the option. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::set_socket_option | ( | xtd::net::sockets::socket_option_level | socket_option_level, |
xtd::net::sockets::socket_option_name | socket_option_name, | ||
bool | option_value | ||
) |
Sets the specified xtd::net::sockets::socket option to the specified integer value.
socket_option_level | One of the xtd::net::sockets::socket_option_level values. |
socket_option_name | One of the xtd::net::sockets::socket_option_name values. |
option_value | A value of the option. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::set_socket_option | ( | xtd::net::sockets::socket_option_level | socket_option_level, |
xtd::net::sockets::socket_option_name | socket_option_name, | ||
int32_t | option_value | ||
) |
Sets the specified xtd::net::sockets::socket option to the specified integer value.
socket_option_level | One of the xtd::net::sockets::socket_option_level values. |
socket_option_name | One of the xtd::net::sockets::socket_option_name values. |
option_value | A value of the option. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::set_socket_option | ( | xtd::net::sockets::socket_option_name | socket_option_name, |
xtd::net::sockets::ip_v6_multicast_option | option_value | ||
) |
Sets the linger xtd::net::sockets::socket option to the specified integer value.
socket_option_name | One of the xtd::net::sockets::socket_option_name values. Only xtd::net::sockets::socket_option_name::add_membership and xtd::net::sockets::socket_option_name::drop_membership values are accepted. |
option_value | A value of the option. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::set_socket_option | ( | xtd::net::sockets::socket_option_name | socket_option_name, |
xtd::net::sockets::multicast_option | option_value | ||
) |
Sets the linger xtd::net::sockets::socket option to the specified integer value.
socket_option_name | One of the xtd::net::sockets::socket_option_name values. Only xtd::net::sockets::socket_option_name::add_membership and xtd::net::sockets::socket_option_name::drop_membership values are accepted. |
option_value | A value of the option. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::socket::shutdown | ( | xtd::net::sockets::socket_shutdown | how | ) |
Disables sends and receives on a xtd::net::sockets::socket.
how | One of the xtd::net::sockets::socket_shutdown values that specifies the operation that will no longer be allowed. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
Value | Description |
---|---|
xtd::net::sockets::socket_shutdown::send | Disable sending on this xtd::net::sockets::socket. |
xtd::net::sockets::socket_shutdown::receive | Disable receiving on this xtd::net::sockets::socket. |
xtd::net::sockets::socket_shutdown::both | Disable both sending and receiving on this xtd::net::sockets::socket. |
|
noexcept |
Gets the type of the xtd::net::sockets::socket.
byte_t xtd::net::sockets::socket::ttl | ( | ) | const |
Gets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::socket.
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::not_supported_exception | he xtd::net::sockets::socket is not in the xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6 families. |
socket & xtd::net::sockets::socket::ttl | ( | byte_t | value | ) |
Sets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::socket.
value | The TTL value. |
xtd::net::sockets::socket_exception | This option is valid for a datagram socket only. |
xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
xtd::not_supported_exception | he xtd::net::sockets::socket is not in the xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6 families. |