Seastar
High performance C++ framework for concurrent servers
Public Types | Public Member Functions | List of all members
seastar::server_socket Class Reference

Detailed Description

A listening socket, waiting to accept incoming network connections.

#include <seastar/net/api.hh>

Public Types

enum class  load_balancing_algorithm { connection_distribution , port , fixed , default_ = connection_distribution }
 

Public Member Functions

 server_socket () noexcept
 Constructs a server_socket without being bound to any address.
 
 server_socket (server_socket &&ss) noexcept
 Moves a server_socket object.
 
server_socketoperator= (server_socket &&cs) noexcept
 Move-assigns a server_socket object.
 
future< accept_resultaccept ()
 
void abort_accept ()
 
socket_address local_address () const noexcept
 
 operator bool () const noexcept
 

Member Function Documentation

◆ abort_accept()

void seastar::server_socket::abort_accept ( )

Stops any accept() in progress.

Current and future accept() calls will terminate immediately with an error.

◆ accept()

future<accept_result> seastar::server_socket::accept ( )

Accepts the next connection to successfully connect to this socket.

Returns
an accept_result representing the connection and the socket_address of the remote endpoint.
See also
listen(socket_address sa)
listen(socket_address sa, listen_options opts)

◆ local_address()

socket_address seastar::server_socket::local_address ( ) const
noexcept

Local bound address

Returns
the local bound address if the server_socket is listening, an empty address constructed with socket_address() otherwise.
See also
listen(socket_address sa)
listen(socket_address sa, listen_options opts)

◆ operator bool()

seastar::server_socket::operator bool ( ) const
inlineexplicitnoexcept

Check whether the server_socket is listening on any address.

Returns
true if this socket_address is bound to an address, false if it is just created with the default constructor.
See also
listen(socket_address sa)
listen(socket_address sa, listen_options opts)

The documentation for this class was generated from the following file: