Class TCPListenerIPv6#
Defined in File TCPListenerIPv6.h
Inheritance Relationships#
Base Type#
public TRAP::Network::Socket
(Class Socket)
Class Documentation#
-
class TCPListenerIPv6 : public TRAP::Network::Socket#
Socket that listens to new TCP connections.
Public Functions
-
constexpr TCPListenerIPv6() noexcept#
Constructor.
-
consteval TCPListenerIPv6(const TCPListenerIPv6&) = delete#
Copy constructor.
-
consteval TCPListenerIPv6 &operator=(const TCPListenerIPv6&) = delete#
Copy assignment operator.
-
constexpr TCPListenerIPv6(TCPListenerIPv6&&) noexcept = default#
Move constructor.
-
TCPListenerIPv6 &operator=(TCPListenerIPv6&&) noexcept = default#
Move assignment operator.
-
~TCPListenerIPv6() override = default#
Destructor.
-
u16 GetLocalPort() const#
Get the port to which the socket is bound locally.
If the socket is not listening to a port, this function returns 0.
- Returns:
Port to which the socket is bound.
-
Status Listen(u16 port, const IPv6Address &address = IPv6Address::Any)#
Start listening for incoming connection attempts.
This function makes the socket start listening on the specified port, waiting for incoming connection attempts.
If the socket is already listening on a port when this function is called, it will stop listening on the old port before starting to listen on the new port.
When providing TRAP::Network::Socket::AnyPort as port, the listener will request an available port from the system. The chosen port can be retrieved by calling GetLocalPort().
- Parameters:
port – Port to listen on for incoming connection attempts.
address – Address of the interface to listen on.
- Returns:
Status code.
-
void Close()#
Stop listening and close the socket.
This function gracefully stops the listener. If the socket is not listening, this function has no effect.
-
Status Accept(TCPSocketIPv6 &socket) const#
Accept a new connection.
If the socket is in blocking mode, this function will not return until a connection is actually received.
- Parameters:
socket – Socket that will hold the new connection.
- Returns:
Status code.
-
constexpr TCPListenerIPv6() noexcept#