#include <base_socket.hpp>
|
using | endpoint_type = EndpointType |
|
using | address_type = typename EndpointType::address_type |
|
|
bool | is_open () const |
|
socket_type | handle () const |
|
std::uint64_t | socket_id () const |
|
bool | set_io_mode (fly::net::IOMode mode) |
|
fly::net::IOMode | io_mode () const |
|
std::optional< EndpointType > | local_endpoint () const |
|
void | close () |
|
bool | bind (const EndpointType &endpoint, BindMode mode) const |
|
bool | bind (std::string_view hostname, port_type port, BindMode mode) const |
|
template<fly::net::IPEndpoint EndpointType>
class fly::net::detail::BaseSocket< EndpointType >
Base class to represent a network socket and provide functionality needed by all concrete socket types.
- Author
- Timothy Flynn (trfly.nosp@m.nn89.nosp@m.@pm.m.nosp@m.e)
- Version
- February 13, 2021
◆ BaseSocket() [1/3]
template<fly::net::IPEndpoint EndpointType>
Constructor. Initialize the socket in the provided IO processing mode.
- Parameters
-
config | Reference to network configuration. |
handle | Native socket handle opened by the concrete socket type. |
mode | IO processing mode to apply to the socket. |
◆ BaseSocket() [2/3]
template<fly::net::IPEndpoint EndpointType>
Constructor. Initialize the socket in an asynchronous IO processing mode armed with the provided socket service for performing IO operations.
- Parameters
-
service | The socket service for performing IO operations. |
config | Reference to network configuration. |
handle | Native socket handle opened by the concrete socket type. |
◆ BaseSocket() [3/3]
template<fly::net::IPEndpoint EndpointType>
Move constructor. The provided socket is left in an invalid state.
- Parameters
-
socket | The socket instance to move. |
◆ ~BaseSocket()
template<fly::net::IPEndpoint EndpointType>
Destructor. If needed, close the socket.
◆ bind() [1/2]
template<fly::net::IPEndpoint EndpointType>
Bind this socket to a local endpoint.
- Parameters
-
endpoint | The local endpoint to bind to. |
mode | Binding mode to apply to the socket before binding. |
- Returns
- True if the binding was successful.
◆ bind() [2/2]
template<fly::net::IPEndpoint EndpointType>
Bind this socket to a local endpoint.
- Parameters
-
hostname | The hostname or IP address string to bind to. |
port | The port to bind to. |
mode | Binding mode to apply to the socket before binding. |
- Returns
- True if the binding was successful.
◆ close()
template<fly::net::IPEndpoint EndpointType>
If this socket is valid, close this socket.
◆ handle()
template<fly::net::IPEndpoint EndpointType>
- Returns
- This socket's native handle.
◆ hostname_to_address()
template<fly::net::IPEndpoint EndpointType>
Convert a hostname or IP address string to an IP address.
- Parameters
-
hostname | The hostname or IP address string to convert. |
- Returns
- If successful, the created IP address. Otherwise, an uninitialized value.
◆ io_mode()
template<fly::net::IPEndpoint EndpointType>
- Returns
- This socket's IO processing mode.
◆ is_ipv4()
template<fly::net::IPEndpoint EndpointType>
- Returns
- True if this is an IPv4 socket.
◆ is_ipv6()
template<fly::net::IPEndpoint EndpointType>
- Returns
- True if this is an IPv6 socket.
◆ is_open()
template<fly::net::IPEndpoint EndpointType>
- Returns
- True if the socket handle is opened.
◆ local_endpoint()
template<fly::net::IPEndpoint EndpointType>
Retrieve the local endpoint to which this socket is bound.
- Returns
- If successful, the bound endpoint. Otherwise, an uninitialized value.
◆ network_config()
template<fly::net::IPEndpoint EndpointType>
- Returns
- A strong pointer to the network configuration.
◆ operator=()
template<fly::net::IPEndpoint EndpointType>
Move assignment operator. The provided socket is left in an invalid state.
- Parameters
-
socket | The socket instance to move. |
- Returns
- A reference to this socket.
◆ packet_size()
template<fly::net::IPEndpoint EndpointType>
- Returns
- Size of packet to use for IO operations.
◆ set_io_mode()
template<fly::net::IPEndpoint EndpointType>
Configure the socket to operate in the provided IO processing mode.
- Parameters
-
mode | IO processing mode to apply to the socket. |
- Returns
- True if the operation was successful.
◆ socket_id()
template<fly::net::IPEndpoint EndpointType>
- Returns
- This socket's unique ID.
◆ socket_service()
template<fly::net::IPEndpoint EndpointType>
- Returns
- A strong (possibly null) pointer to the socket service.
The documentation for this class was generated from the following files:
- fly/net/socket/detail/base_socket.hpp
- fly/net/socket/detail/base_socket.cpp