#include <listen_socket.hpp>
template<IPEndpoint EndpointType>
class fly::net::ListenSocket< EndpointType >
Class to represent a listening socket for accepting incoming network connection requests from connection-oriented sockets.
- Author
- Timothy Flynn (trfly.nosp@m.nn89.nosp@m.@pm.m.nosp@m.e)
- Version
- February 13, 2021
◆ ListenSocket() [1/3]
template<IPEndpoint EndpointType>
Constructor. Open the socket in a synchronous IO processing mode.
- Parameters
-
config | Reference to network configuration. |
◆ ListenSocket() [2/3]
template<IPEndpoint EndpointType>
Constructor. Open the socket in the provided IO processing mode.
- Parameters
-
config | Reference to network configuration. |
mode | IO processing mode to apply to the socket. |
◆ ListenSocket() [3/3]
template<IPEndpoint EndpointType>
Move constructor. The provided socket is left in a non-listening, invalid state.
- Parameters
-
socket | The socket instance to move. |
◆ accept()
template<IPEndpoint EndpointType>
Accept an incoming connection on this listening socket. If an error occurs on the socket, the socket will be closed.
- Returns
- If successful, the accepted socket. Otherwise, an uninitialized value.
◆ accept_async()
template<IPEndpoint EndpointType>
Asynchronously accept an incoming connection on this listening socket. May only be used if this socket was created through a socket service.
If successful, the provided callback will be invoked with the accepted socket upon completion. Otherwise, the provided callback will be invoked with an uninitialized value, and the socket will be closed before the invocation.
- Parameters
-
callback | The callback to invoke when the operation has completed. |
- Returns
- True if the socket service and the provided callback are valid.
◆ close()
template<IPEndpoint EndpointType>
If this socket is valid, close this socket.
◆ handle()
template<IPEndpoint EndpointType>
- Returns
- This socket's native handle.
◆ io_mode()
template<IPEndpoint EndpointType>
- Returns
- This socket's IO processing mode.
◆ is_listening()
template<IPEndpoint EndpointType>
- Returns
- True if this socket is listening for incoming connections.
◆ listen()
template<IPEndpoint EndpointType>
Configure this socket to be used to accept incoming connections.
- Returns
- True if the operation was successful.
◆ operator=()
template<IPEndpoint EndpointType>
Move assignment operator. The provided socket is left in a non-listening, invalid state.
- Parameters
-
socket | The socket instance to move. |
- Returns
- A reference to this socket.
The documentation for this class was generated from the following files: