group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HostedServer Class Reference

Starts, monitors, and shuts down a server process spawned by the client. More...

#include <HostedServer.hpp>

Public Member Functions

bool start (const HostConfigState &config, std::string &outError)
 Launch the server executable with the requested hosting options.
void shutdown ()
 Stop the locally owned hosted server process.
bool isRunning ()
 True if the app still owns a child server process.
uint16_t port ()
 Actual server port reported by the child process, or 0 when not running.
bool hasSession () const
 True when this client has launched a hosted session and still knows its port.
void clearSession ()
 Forget hosted-session metadata after a confirmed local or remote shutdown.

Private Member Functions

void detachForPersistence ()
 Drop local ownership of a persistent server after successful launch.

Private Attributes

pid_t childPid = -1
 POSIX child pid for the hosted server, or -1 when none is running.
uint16_t boundPort = 0
 Port printed by the child server READY line.

Detailed Description

Starts, monitors, and shuts down a server process spawned by the client.

Member Function Documentation

◆ clearSession()

void HostedServer::clearSession ( )

Forget hosted-session metadata after a confirmed local or remote shutdown.

◆ detachForPersistence()

void HostedServer::detachForPersistence ( )
private

Drop local ownership of a persistent server after successful launch.

Here is the caller graph for this function:

◆ hasSession()

bool HostedServer::hasSession ( ) const

True when this client has launched a hosted session and still knows its port.

Here is the caller graph for this function:

◆ isRunning()

bool HostedServer::isRunning ( )

True if the app still owns a child server process.

Here is the caller graph for this function:

◆ port()

uint16_t HostedServer::port ( )

Actual server port reported by the child process, or 0 when not running.

Here is the caller graph for this function:

◆ shutdown()

void HostedServer::shutdown ( )

Stop the locally owned hosted server process.

◆ start()

bool HostedServer::start ( const HostConfigState & config,
std::string & outError )

Launch the server executable with the requested hosting options.

Parameters
configHost-screen options, including port and transport mode.
outErrorFilled with a user-facing error if launch fails.
Returns
True once the child server reports its bound port.
Here is the call graph for this function:

Member Data Documentation

◆ boundPort

uint16_t HostedServer::boundPort = 0
private

Port printed by the child server READY line.

◆ childPid

pid_t HostedServer::childPid = -1
private

POSIX child pid for the hosted server, or -1 when none is running.


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