Samchon Framework for CPP  1.0.0
samchon::protocol::Server Class Referenceabstract

#include <Server.hpp>

Public Member Functions

 Server ()
 
virtual ~Server ()
 
virtual void open (int port)
 
virtual void close ()
 

Protected Member Functions

virtual void addClient (std::shared_ptr< ClientDriver >)=0
 

Detailed Description

A server.

The Server is an abstract class providing methods for opening a server and accepting clients. The server opened by this Server class follows the protocol of Samchon Framework's own.

To open a server, extends the Server class and overrides addClient() method to define what to do with a newly connected remote clients. At last, call open() method with the specified port number.

Below codes and classes will be good examples for comprehending how to open a server and handle remote clients.

Note that, this Server class follows the protocol of Samchon Framework's own. If you want to provide a realtime web-service, then use WebServer instead, that is following the web-socket protocol.

Protocol Derived Type Related ClientDriver
Samchon Framework's own Server ClientDriver
Web-socket protocol WebServer WebClientDriver
Basic Components
See also
ClientDriver Protocol - Basic Components
Author
Jeongho Nam http://samchon.org

Definition at line 45 of file Server.hpp.

Constructor & Destructor Documentation

samchon::protocol::Server::Server ( )
inline

Default Constructor.

Definition at line 54 of file Server.hpp.

virtual samchon::protocol::Server::~Server ( )
inlinevirtual

Default Destructor.

Reimplemented in samchon::templates::service::Server.

Definition at line 61 of file Server.hpp.

References close().

Here is the call graph for this function:

Member Function Documentation

virtual void samchon::protocol::Server::open ( int  port)
inlinevirtual

Open server.

Parameters
portPort number to open.

Definition at line 74 of file Server.hpp.

Referenced by samchon::templates::parallel::MediatorServer::start().

Here is the caller graph for this function:

virtual void samchon::protocol::Server::close ( )
inlinevirtual

Close the server.

Definition at line 100 of file Server.hpp.

References addClient().

Referenced by ~Server().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void samchon::protocol::Server::addClient ( std::shared_ptr< ClientDriver )
protectedpure virtual

Add a newly connected remote client.

The addClient() is an abstract method being called when a remote client is newly connected with IClientDriver object who communicates with the remote system. Overrides this method and defines what to do with the driver, a newly connected remote client.

Below methods and example codes may be good for comprehending how to utilizing this addClient method.

Parameters
driverA communicator with (newly connected) remote client.

Referenced by close(), and samchon::protocol::WebServer::WebServer().

Here is the caller graph for this function:


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