Implements the Berkeley sockets interface.
Public Constructors | |
socket () | |
Initializes a new instance of the xtd::net::sockets::socket class. | |
socket (intptr handle) | |
Initializes a new instance of the xtd::net::sockets::socket class for the specified socket handle. | |
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 (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 (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. | |
Public Properties | |
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. | |
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. | |
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. | |
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. | |
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. | |
intptr | handle () const noexcept |
Gets the operating system handle for the xtd::net::sockets::socket. | |
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. | |
xtd::sptr< 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. | |
xtd::net::sockets::protocol_type | protocol_type () const noexcept |
Gets the protocol type of the xtd::net::sockets::socket. | |
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. | |
int32 | 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 value) |
Sets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::receive call will time out. | |
xtd::sptr< xtd::net::end_point > | remote_end_point () const |
Gets the remote endpoint. | |
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 | 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 value) |
Sets 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_type | socket_type () const noexcept |
Gets the type of the xtd::net::sockets::socket. | |
xtd::byte | 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 (xtd::byte 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 Methods | |
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::sptr< xtd::iasync_result > | begin_accept (xtd::async_callback callback, const std::any &state) |
Begins an asynchronous operation to accept an incoming connection attempt. | |
template<class end_point_t > | |
xtd::sptr< 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. | |
xtd::sptr< xtd::iasync_result > | begin_connect (const xtd::net::ip_address &address, uint16 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. | |
xtd::sptr< xtd::iasync_result > | begin_connect (const xtd::array< xtd::net::ip_address > &addresses, uint16 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. | |
xtd::sptr< xtd::iasync_result > | begin_connect (const xtd::string &host, uint16 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. | |
xtd::sptr< 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. | |
xtd::sptr< xtd::iasync_result > | begin_receive (xtd::array< xtd::byte > &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. | |
xtd::sptr< xtd::iasync_result > | begin_receive (xtd::array< xtd::byte > &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. | |
xtd::sptr< xtd::iasync_result > | begin_receive_from (xtd::array< xtd::byte > &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. | |
xtd::sptr< xtd::iasync_result > | begin_receive_message_from (xtd::array< xtd::byte > &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. | |
xtd::sptr< xtd::iasync_result > | begin_send (const xtd::array< xtd::byte > &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. | |
xtd::sptr< xtd::iasync_result > | begin_send (const xtd::array< xtd::byte > &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. | |
xtd::sptr< xtd::iasync_result > | begin_send_to (const xtd::array< xtd::byte > &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<class end_point_t > | |
void | bind (const end_point_t &local_end_point) |
Associates a xtd::net::sockets::socket with a local endpoint. | |
void | close () |
Closes the xtd::net::sockets::socket connection and releases all associated resources. | |
template<class end_point_t > | |
void | connect (const end_point_t &remote_end_point) |
Establishes a connection to a remote host. | |
void | connect (const xtd::net::ip_address &address, uint16 port) |
Establishes a connection to a remote host. The host is specified by an IP address and a port number. | |
void | connect (const xtd::array< xtd::net::ip_address > &addresses, uint16 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::string &host, uint16 port) |
Establishes a connection to a remote host. The host is specified by a host name and a port number. | |
void | disconnect (bool reuse_socket) |
Closes the socket connection and allows reuse of the socket. | |
socket | end_accept (xtd::sptr< 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 (xtd::sptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous connection request. | |
void | end_disconnect (xtd::sptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous disconnect request. | |
size_t | end_receive (xtd::sptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous read. | |
size_t | end_receive (xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code) |
Ends a pending asynchronous read. | |
size_t | end_receive_from (xtd::sptr< xtd::iasync_result > async_result, xtd::sptr< xtd::net::end_point > &end_point) |
Ends a pending asynchronous read from a specific endpoint. | |
size_t | 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) |
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 (xtd::sptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous send. | |
size_t | end_send (xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code) |
Ends a pending asynchronous send. | |
size_t | end_send_to (xtd::sptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous send to a specific location. | |
bool | equals (const xtd::object &obj) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (const socket &other) const noexcept override |
Determines whether the specified object is equal to the current object. | |
size_t | get_raw_socket_option (int32 socket_option_level, int32 socket_option_name, intptr option_value, size_t size_option_value) const |
Gets a socket option value using platform-specific level and name identifiers. | |
int32 | 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. | |
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. | |
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. | |
size_t | io_control (int32 io_control_code, xtd::array< xtd::byte > &option_in_value, xtd::array< xtd::byte > &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, xtd::array< xtd::byte > &option_in_value, xtd::array< xtd::byte > &option_out_value) |
Sets low-level operating modes for the xtd::net::sockets::socket using xtd::net::sockets::io_control_code control codes. | |
void | listen (size_t backlog) |
Places a xtd::net::sockets::socket in a listening state. | |
void | listen () |
Places a xtd::net::sockets::socket in a listening state. | |
bool | poll (int32 micro_seconds, xtd::net::sockets::select_mode mode) |
Determines the status of the xtd::net::sockets::socket. | |
size_t | receive (xtd::array< xtd::byte > &buffer) |
Receives data from a bound xtd::net::sockets::socket into a receive buffer. | |
size_t | receive (xtd::array< xtd::byte > &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 (xtd::array< xtd::byte > &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 (xtd::array< xtd::byte > &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 (xtd::array< xtd::byte > &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_from (xtd::array< xtd::byte > &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 (xtd::array< xtd::byte > &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_from (xtd::array< xtd::byte > &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 (xtd::array< xtd::byte > &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_message_from (xtd::array< xtd::byte > &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) |
size_t | send (const xtd::array< xtd::byte > &buffer) |
Sends data to a connected xtd::net::sockets::socket. | |
size_t | send (const xtd::array< xtd::byte > &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 (const xtd::array< xtd::byte > &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 xtd::array< xtd::byte > &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 xtd::array< xtd::byte > &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_to (const xtd::array< xtd::byte > &buffer, const xtd::net::end_point &remote_end_point) |
Sends data to the specified endpoint. | |
size_t | send_to (const xtd::array< xtd::byte > &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. | |
size_t | send_to (const xtd::array< xtd::byte > &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 xtd::array< xtd::byte > &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. | |
void | set_ip_protection_level (xtd::net::sockets::ip_protection_level level) |
Sets the IP protection level on a socket. | |
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 option_value) |
Sets the specified xtd::net::sockets::socket option to the specified integer value. | |
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_name socket_option_name, const xtd::net::sockets::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, const xtd::net::sockets::ip_v6_multicast_option &option_value) |
Sets the linger xtd::net::sockets::socket option to the specified integer value. | |
void | set_raw_socket_option (int32 socket_option_level, int32 socket_option_name, intptr option_value, size_t option_value_size) |
Sets a socket option value using platform-specific level and name identifiers. | |
void | shutdown (xtd::net::sockets::socket_shutdown how) |
Disables sends and receives on a xtd::net::sockets::socket. | |
Public Static Properties | |
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). | |
Public Static Methods | |
static size_t | select (xtd::collections::generic::ilist< socket > &check_read, xtd::collections::generic::ilist< socket > &check_write, xtd::collections::generic::ilist< socket > &check_error, int32 microseconds) |
Determines the status of one or more sockets. | |
Additional Inherited Members | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual xtd::size | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<class object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
virtual xtd::string | to_string () const noexcept |
Returns a xtd::string that represents the current object. | |
![]() | |
virtual bool | equals (const socket &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. | |
![]() | |
template<class object_a_t , class object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<class object_a_t , class object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &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.
|
explicit |
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. |
|
explicit |
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. |
|
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. |
bool xtd::net::sockets::socket::blocking | ( | ) | const |
Gets a value that indicates whether the xtd::net::sockets::socket is in blocking mode.
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. |
false
. The xtd::net::sockets::socket::blocking property has no effect on asynchronous methods. If you are sending and receiving data asynchronously and want to block execution, use the xtd::threading::manual_reset_event class. 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. |
false
. The xtd::net::sockets::socket::blocking property has no effect on asynchronous methods. If you are sending and receiving data asynchronously and want to block execution, use the xtd::threading::manual_reset_event class.
|
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.
true
if the xtd::net::sockets::socket was connected to a remote resource as of the most recent operation; otherwise, false
. false
, the xtd::net::sockets::socket was either never connected, or is no longer connected. xtd::net::sockets::socket::connected is not thread-safe; it may return true
after an operation is aborted when the xtd::net::sockets::socket is disconnected from another thread. true
; however, this action does not change the inherent connectionless nature of UDP. 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.
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. |
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.
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. |
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.
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::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. |
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.
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. |
false
, multiple sockets can use the xtd::net::sockets::socket::bind method to bind to a specific port; however only one of the sockets can perform operations on the network traffic sent to the port. If more than one socket attempts to use the xtd::net::sockets::socket::bind method to bind to a particular port, then the one with the more specific IP address will handle the network traffic sent to that port. true
, the first use of the xtd::net::sockets::socket::bind method to attempt to bind to a particular port, regardless of Internet Protocol (IP) address, will succeed; all subsequent uses of the xtd::net::sockets::socket::bind method to attempt to bind to that port will fail until the original bound socket is destroyed. 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. |
false
, multiple sockets can use the xtd::net::sockets::socket::bind method to bind to a specific port; however only one of the sockets can perform operations on the network traffic sent to the port. If more than one socket attempts to use the xtd::net::sockets::socket::bind method to bind to a particular port, then the one with the more specific IP address will handle the network traffic sent to that port. true
, the first use of the xtd::net::sockets::socket::bind method to attempt to bind to a particular port, regardless of Internet Protocol (IP) address, will succeed; all subsequent uses of the xtd::net::sockets::socket::bind method to attempt to bind to that port will fail until the original bound socket is destroyed.
|
noexcept |
Gets the operating system handle for the xtd::net::sockets::socket.
|
noexcept |
Gets a value that indicates whether the xtd::net::sockets::socket is bound to a specific local port.
true
if the xtd::net::sockets::socket is bound to a local port; otherwise, false
. 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. |
xtd::sptr< 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.
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. |
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.
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. |
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. |
|
noexcept |
Gets the protocol type of the xtd::net::sockets::socket.
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. |
int32 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. |
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. |
xtd::sptr< 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. |
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 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. |
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. |
|
noexcept |
Gets the type of the xtd::net::sockets::socket.
xtd::byte 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. |
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. |
|
staticnoexcept |
Indicates whether the underlying operating system and network adaptors support Internet Protocol version 4 (IPv4).
true
if the operating system and network adaptors support the IPv4 protocol; otherwise, false
.
|
staticnoexcept |
Indicates whether the underlying operating system and network adaptors support Internet Protocol version 6 (IPv6).
true
if the operating system and network adaptors support the IPv6 protocol; otherwise, false
. 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. |
true
if the I/O operation is pending. The Completed event on the e parameter will be raised upon completion of the operation. false
if the I/O operation completed synchronously. The Completed event on the e parameter will not be raised and the e object passed as a parameter may be examined immediately after the method call returns to retrieve the result of the 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(). |
xtd::sptr< 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(). |
true
. If you cannot, xtd::net::sockets::socket::begin_connect will throw a xtd::net::sockets::socket_exception. xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_connect | ( | const xtd::net::ip_address & | address, |
uint16 | 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_connect | ( | const xtd::array< xtd::net::ip_address > & | addresses, |
uint16 | 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_connect | ( | const xtd::string & | host, |
uint16 | 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(). |
xtd::sptr< 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(). |
true
, you can reuse the socket. xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive | ( | xtd::array< xtd::byte > & | 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 xtd::byte 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive | ( | xtd::array< xtd::byte > & | 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 xtd::byte 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive_from | ( | xtd::array< xtd::byte > & | 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 xtd::byte 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_receive_message_from | ( | xtd::array< xtd::byte > & | 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 xtd::byte 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_send | ( | const xtd::array< xtd::byte > & | 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 xtd::byte 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_send | ( | const xtd::array< xtd::byte > & | 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 xtd::byte 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(). |
xtd::sptr< xtd::iasync_result > xtd::net::sockets::socket::begin_send_to | ( | const xtd::array< xtd::byte > & | 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 xtd::byte 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. |
void xtd::net::sockets::socket::close | ( | ) |
Closes the xtd::net::sockets::socket connection and releases all associated resources.
false
. false
and specifying a non-zero time-out interval. xtd::net::sockets::socket::close will then block until this data is sent or until the specified time-out expires. If you set xtd::net::sockets::socket::dont_linger to false
and specify a zero time-out interval, xtd::net::sockets::socket::close releases the connection and automatically discards outgoing queued data. false
, create a xtd::net::sockets::linger_option, set the xtd::net::sockets::linger_option::enabled property to true
, and set the xtd::net::sockets::linger_option::linger_time property to the desired time out period. Use this xtd::net::sockets::linger_option along with the xtd::net::sockets::socket::dont_linger socket option to call the xtd::net::sockets::socket::set_socket_linger_option method.
|
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. |
false
prior to calling xtd::net::sockets::socket::connect. If you are using a connection-oriented protocol like TCP and you do disable blocking, xtd::net::sockets::socket::connect will throw a xtd::net::sockets::socket_exception because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use xtd::net::sockets::socket_exception::error_code to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented xtd::net::sockets::socket, but has not yet completed successfully. Use the Poll method to determine when the xtd::net::sockets::socket is finished connecting. void xtd::net::sockets::socket::connect | ( | const xtd::net::ip_address & | address, |
uint16 | 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. |
false
prior to calling xtd::net::sockets::socket::connect. If you are using a connection-oriented protocol like TCP and you do disable blocking, xtd::net::sockets::socket::connect will throw a xtd::net::sockets::socket_exception because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use xtd::net::sockets::socket_exception::error_code to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented xtd::net::sockets::socket, but has not yet completed successfully. Use the Poll method to determine when the xtd::net::sockets::socket is finished connecting. void xtd::net::sockets::socket::connect | ( | const xtd::array< xtd::net::ip_address > & | addresses, |
uint16 | 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. |
false
prior to calling xtd::net::sockets::socket::connect. If you are using a connection-oriented protocol like TCP and you do disable blocking, xtd::net::sockets::socket::connect will throw a xtd::net::sockets::socket_exception because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use xtd::net::sockets::socket_exception::error_code to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented xtd::net::sockets::socket, but has not yet completed successfully. Use the Poll method to determine when the xtd::net::sockets::socket is finished connecting. void xtd::net::sockets::socket::connect | ( | const xtd::string & | host, |
uint16 | 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. |
false
prior to calling xtd::net::sockets::socket::connect. If you are using a connection-oriented protocol like TCP and you do disable blocking, xtd::net::sockets::socket::connect will throw a xtd::net::sockets::socket_exception because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use xtd::net::sockets::socket_exception::error_code to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented xtd::net::sockets::socket, but has not yet completed successfully. Use the Poll method to determine when the xtd::net::sockets::socket is finished connecting. 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. |
false
. However, if reuseSocket is true
, you can reuse the socket. false
and specify a nonzero time-out interval to ensure that data queued for outgoing transmission is sent. xtd::net::sockets::socket::disconnect then blocks until the data is sent or until the specified time-out expires. If you set xtd::net::sockets::socket::dont_linger to false
and specify a zero time-out interval, xtd::net::sockets::socket::close releases the connection and automatically discards outgoing queued data. socket xtd::net::sockets::socket::end_accept | ( | xtd::sptr< 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 | ( | xtd::sptr< 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 | ( | xtd::sptr< 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 | ( | xtd::sptr< 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 | ( | xtd::sptr< 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 | ( | xtd::sptr< xtd::iasync_result > | async_result, |
xtd::sptr< 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 | ( | 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 | ||
) |
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 | ( | xtd::sptr< 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 | ( | xtd::sptr< 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 | ( | xtd::sptr< 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. |
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. Reimplemented from xtd::object.
|
overridenoexcept |
Determines whether the specified object is equal to the current object.
other | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. size_t xtd::net::sockets::socket::get_raw_socket_option | ( | int32 | socket_option_level, |
int32 | socket_option_name, | ||
intptr | 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. |
int32 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. |
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. |
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. |
size_t xtd::net::sockets::socket::io_control | ( | int32 | io_control_code, |
xtd::array< xtd::byte > & | option_in_value, | ||
xtd::array< xtd::byte > & | option_out_value | ||
) |
Sets low-level operating modes for the xtd::net::sockets::socket using numerical control codes.
io_control_code | An int32 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, |
xtd::array< xtd::byte > & | option_in_value, | ||
xtd::array< xtd::byte > & | 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. |
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. |
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. |
bool xtd::net::sockets::socket::poll | ( | int32 | 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. |
size_t xtd::net::sockets::socket::receive | ( | xtd::array< xtd::byte > & | 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 | ( | xtd::array< xtd::byte > & | 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 | ( | xtd::array< xtd::byte > & | 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 | ( | xtd::array< xtd::byte > & | 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 | ( | xtd::array< xtd::byte > & | 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_from | ( | xtd::array< xtd::byte > & | 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 | ( | xtd::array< xtd::byte > & | 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. |
size_t xtd::net::sockets::socket::receive_from | ( | xtd::array< xtd::byte > & | 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 | ( | xtd::array< xtd::byte > & | 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::send | ( | const xtd::array< xtd::byte > & | 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 xtd::array< xtd::byte > & | 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 | ( | const xtd::array< xtd::byte > & | 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 xtd::array< xtd::byte > & | 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 xtd::array< xtd::byte > & | 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_to | ( | const xtd::array< xtd::byte > & | 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 xtd::array< xtd::byte > & | 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. |
size_t xtd::net::sockets::socket::send_to | ( | const xtd::array< xtd::byte > & | 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 xtd::array< xtd::byte > & | 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. |
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_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 | 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::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_name | socket_option_name, |
const 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::set_socket_option | ( | xtd::net::sockets::socket_option_name | socket_option_name, |
const 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_raw_socket_option | ( | int32 | socket_option_level, |
int32 | socket_option_name, | ||
intptr | 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::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. |
|
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. |