Public Member Functions | List of all members
rapidsmpf::bootstrap::detail::SocketServer Class Reference

In-process TCP coordination server, intended to run inside rrun. More...

#include <socket_backend.hpp>

Public Member Functions

 SocketServer (int nranks)
 Start the server. More...
 
 ~SocketServer ()
 Shut down the server and join all threads. More...
 
std::string const & address () const noexcept
 Returns the server address as "127.0.0.1:<port>". More...
 
std::string const & token () const noexcept
 Returns the 64-character hex-encoded 256-bit authentication token. More...
 
 SocketServer (SocketServer const &)=delete
 
SocketServeroperator= (SocketServer const &)=delete
 
 SocketServer (SocketServer &&)=delete
 
SocketServeroperator= (SocketServer &&)=delete
 

Detailed Description

In-process TCP coordination server, intended to run inside rrun.

Binds to 127.0.0.1:0 (OS assigns an ephemeral port), generates a 256-bit random authentication token via getrandom(2), and starts an accept thread.

Definition at line 31 of file socket_backend.hpp.

Constructor & Destructor Documentation

◆ SocketServer()

rapidsmpf::bootstrap::detail::SocketServer::SocketServer ( int  nranks)
explicit

Start the server.

Binds to 127.0.0.1:0, generates a 256-bit token, and starts the accept thread. The server is ready to accept connections before this constructor returns.

Parameters
nranksNumber of rank clients expected to connect.
Exceptions
std::runtime_erroron socket/bind/listen/getrandom failure.

◆ ~SocketServer()

rapidsmpf::bootstrap::detail::SocketServer::~SocketServer ( )

Shut down the server and join all threads.

Closes the listen socket (which unblocks accept()), then joins the accept thread and all connection-handler threads.

Member Function Documentation

◆ address()

std::string const& rapidsmpf::bootstrap::detail::SocketServer::address ( ) const
inlinenoexcept

Returns the server address as "127.0.0.1:<port>".

Returns
Reference to the address string, valid for the lifetime of this object.

Definition at line 58 of file socket_backend.hpp.

◆ token()

std::string const& rapidsmpf::bootstrap::detail::SocketServer::token ( ) const
inlinenoexcept

Returns the 64-character hex-encoded 256-bit authentication token.

Returns
Reference to the token string, valid for the lifetime of this object.

Definition at line 67 of file socket_backend.hpp.


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