43 explicit async_result_socket(
const xtd::any_object& async_state) : async_state_(async_state) {}
44 xtd::any_object async_state()
const noexcept override {
return async_state_;}
46 bool completed_synchronously()
const noexcept override {
return false;}
47 bool is_completed()
const noexcept override {
return is_completed_;};
50 bool is_completed_ =
false;
53 std::exception_ptr exception_;
56 class async_result_accept_socket :
public async_result_socket {
58 explicit async_result_accept_socket(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
62 class async_result_accept_tcp_client :
public async_result_socket {
64 explicit async_result_accept_tcp_client(
const xtd::any_object& async_state) : async_result_socket(async_state) {}
213 bool equals(const
object& obj) const noexcept override;
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Represents the status of an asynchronous operation.
Definition iasync_result.hpp:25
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Identifies a network address. This is an abstract class.
Definition end_point.hpp:27
Provides an Internet Protocol (IP) address.
Definition ip_address.hpp:42
Represents a network endpoint as an IP address and a port number.
Definition ip_end_point.hpp:28
Implements the Berkeley sockets interface.
Definition socket.hpp:77
Provides client connections for TCP network services.
Definition tcp_client.hpp:48
void start()
xtd::net::sockets::tcp_listener::starts listening for incoming connection requests.
bool exclusive_address_use() const
Gets a bool value that specifies whether the xtd::net::sockets::tcp_listener allows only one underlyi...
xtd::net::sockets::tcp_client accept_tcp_client()
Accepts a pending connection request.
xtd::net::sockets::tcp_client end_accept_tcp_client(xtd::sptr< xtd::iasync_result > async_result)
Asynchronously accepts an incoming connection attempt and creates a new xtd::net::sockets::tcp_client...
xtd::net::sockets::socket accept_socket()
Accepts a pending connection request.
xtd::sptr< xtd::iasync_result > begin_accept_tcp_client(xtd::async_callback callback, const xtd::any_object &state)
Begins an asynchronous operation to accept an incoming connection attempt.
bool pending()
Determines if there are pending connection requests.
static tcp_listener create(uint16 port)
Creates a new xtd::net::sockets::tcp_listener instance to listen on the specified port.
xtd::sptr< xtd::iasync_result > begin_accept_socket(xtd::async_callback callback, const xtd::any_object &state)
Begins an asynchronous operation to accept an incoming connection attempt.
xtd::net::sockets::socket server() const noexcept
Gets the underlying network xtd::net::sockets::socket.
tcp_listener & exclusive_address_use(bool value)
Sets a bool value that specifies whether the xtd::net::sockets::tcp_listener allows only one underlyi...
xtd::net::sockets::socket end_accept_socket(xtd::sptr< xtd::iasync_result > async_result)
Asynchronously accepts an incoming connection attempt and creates a new Socket to handle remote host ...
bool active() const noexcept
Gets a value that indicates whether xtd::net::sockets::tcp_listener is actively listening for client ...
const xtd::net::end_point & local_end_point() const noexcept
Gets the underlying xtd::net::end_point of the current xtd::net::sockets::tcp_listener.
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
void stop()
Closes the listener.
tcp_listener(const xtd::net::ip_address &ip_address, uint16 port)
Initializes a new instance of the xtd::net::sockets::tcp_listener class that listens for incoming con...
tcp_listener(const xtd::net::ip_end_point &local_end_point)
Initializes a new instance of the xtd::net::sockets::tcp_listener class with the specified local endp...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Represents a thread synchronization event that, when signaled, must be reset manually....
Definition manual_reset_event.hpp:35
Encapsulates operating system specific objects that wait for exclusive access to shared resources.
Definition wait_handle.hpp:52
xtd::delegate< void(async_result ar)> async_callback
References a method to be called when a corresponding asynchronous operation completes.
Definition delegate.hpp:39
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
xtd::sptr< xtd::iasync_result > async_result
Represents the status of an asynchronous operation.
Definition async_result.hpp:19
socket_error
Defines error codes for the xtd::net::sockets::socket class.
Definition socket_error.hpp:30
@ success
Operation successful.
Definition socket_error.hpp:34
@ port
The xtd::uri::port data.
Definition uri_components.hpp:25
@ other
The operating system is other.
Definition platform_id.hpp:58
Contains xtd::iequatable interface.
Contains xtd::threading::manual_reset_event exception.
The xtd::net::sockets namespace provides a managed implementation of the Berkeley Sockets interface f...
Definition address_family.hpp:16
The xtd::net namespace provides a simple programming interface for many of the protocols used on netw...
Definition cookie_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::net::sockets::tcp_client class.