phaser-server  0.0.3
Public Member Functions | Static Public Member Functions | List of all members
Session Class Reference

Manage one connection session with a client. More...

#include <session.h>

Inheritance diagram for Session:
Inheritance graph
[legend]
Collaboration diagram for Session:
Collaboration graph
[legend]

Public Member Functions

 Session (cpplib::Connection, PhaseInterface &)
 Construct a Session object. More...
 
void NotifyClient (const std::string &)
 Send a message to the client. More...
 
bool IsQuiet (void) const
 Does this session not accept notifications?
 
std::string ClientInfo (void) const
 Get information about the client associated with this session. More...
 

Static Public Member Functions

static void Manage (void)
 Manage client sessions. More...
 
static void NotifyAllClients (const std::string &)
 Send a message to all client sessions. More...
 

Detailed Description

Manage one connection session with a client.

This thread class serves as a server client session. It manages one client connection, existing only while the connection remains open. Refer to thrlib::Thread documentation for information about object oriented threading and the cpplib::Server for C++ client/server communications.

Constructor & Destructor Documentation

◆ Session()

Session::Session ( cpplib::Connection  con,
PhaseInterface phaser 
)

Construct a Session object.

Initialize a new instance and create its independent thread of execution.

Parameters
con- The established client/server connection.
phaser- Object that manages RF cavity phases.

Member Function Documentation

◆ ClientInfo()

std::string Session::ClientInfo ( void  ) const

Get information about the client associated with this session.

Returns
"[IP address]:[port]"

◆ Manage()

void Session::Manage ( void  )
static

Manage client sessions.

This static function simply listens for client connection requests. When a request is received, it creates a client session thread to handle all communications between the client and the server. This function only returns when it is time to exit the server.

◆ NotifyAllClients()

void Session::NotifyAllClients ( const std::string &  message)
static

Send a message to all client sessions.

This uses the self serializing 'SessionList' for thread safe access to the list of client sessions.

Parameters
message- The message to send.

◆ NotifyClient()

void Session::NotifyClient ( const std::string &  message)

Send a message to the client.

Note
This function may be called by multiple threads, so it serializes access to the client socket.
Parameters
message- Message to be sent.

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