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

A server connector for a physical client. More...

#include <ServerConnector.hpp>

Collaboration diagram for samchon::protocol::ServerConnector:

Public Member Functions

 ServerConnector ()
 Default Constructor. More...
 
virtual auto getIP () const -> std::string=0
 Destinatio IP. More...
 
virtual auto getPort () const -> int=0
 Destination port. More...
 
virtual auto getMyIP () const -> std::string
 (optional) My IP, if you want to bind More...
 
virtual void connect ()
 Connect to a server. More...
 
- Public Member Functions inherited from samchon::protocol::IClient
 IClient ()
 Default Constructor. More...
 
virtual void listen ()
 Listens message from a related system. More...
 
virtual void sendData (std::shared_ptr< Invoke >)
 Sends message to a related system. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
 IProtocol ()
 Default Constructor. More...
 
virtual void replyData (std::shared_ptr< Invoke >)
 Reply a message. More...
 

Protected Attributes

boost::asio::io_service * ioService
 An io_service of Boost.Asio's own. More...
 
EndPoint * endPoint
 An endpoint directing a server. More...
 
EndPoint * localEndPoint
 (Optional) An local endpoint of the client (my system) More...
 
- Protected Attributes inherited from samchon::protocol::IClient
Socket * socket
 Socket for network I/O. More...
 
std::mutex * sendMtx
 A mutex for sending message. More...
 

Additional Inherited Members

- Protected Member Functions inherited from samchon::protocol::IClient
virtual auto BUFFER_SIZE () const -> size_t
 Buffer size of network I/O. More...
 
virtual void _replyData (std::shared_ptr< Invoke >)
 A method for pre-processing replied Invoke message. More...
 

Detailed Description

A server connector for a physical client.

ServerConnector is a class for a physical client connecting a server. If you want to connect to a server, then implements this ServerConnector and just override some methods like getIP(), getPort() and replyData(). That's all.

In Samchon Framework, package protocol, There are basic 3 + 1 components that can make any type of network system in Samchon Framework. The basic 3 components are IProtocol, IServer and IClient. The last, surplus one is the ServerConnector. Looking around classes in Samchon Framework, especially module master and slave which are designed for realizing distributed processing systems and parallel processing systems, physical client classes are all derived from this ServerConnector.

protocol_interface.png
Author
Jeongho Nam http://samchon.org

Definition at line 32 of file ServerConnector.hpp.

Constructor & Destructor Documentation

ServerConnector::ServerConnector ( )

Default Constructor.

Definition at line 14 of file ServerConnector.cpp.

References endPoint, ioService, and localEndPoint.

Member Function Documentation

virtual auto samchon::protocol::ServerConnector::getIP ( ) const -> std::string
pure virtual

Destinatio IP.

Implemented in samchon::protocol::ExternalServer.

Referenced by connect().

Here is the caller graph for this function:

virtual auto samchon::protocol::ServerConnector::getPort ( ) const -> int
pure virtual

Destination port.

Implemented in samchon::protocol::ExternalServer.

Referenced by connect().

Here is the caller graph for this function:

auto ServerConnector::getMyIP ( ) const -> std::string
virtual

(optional) My IP, if you want to bind

Reimplemented in samchon::protocol::ExternalServer.

Definition at line 28 of file ServerConnector.cpp.

Referenced by connect().

Here is the caller graph for this function:

void ServerConnector::connect ( )
virtual

Connect to a server.

Connects to a server with configured ip address and port number. After connection, listens data replied from the server (IClient::listen()).

Note
It monopolies a thread

Reimplemented in samchon::protocol::WebServerConnector.

Definition at line 33 of file ServerConnector.cpp.

References endPoint, getIP(), getMyIP(), getPort(), ioService, localEndPoint, and samchon::protocol::IClient::socket.

Referenced by samchon::protocol::WebServerConnector::connect(), and samchon::protocol::ExternalServer::start().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

boost::asio::io_service* samchon::protocol::ServerConnector::ioService
protected

An io_service of Boost.Asio's own.

Definition at line 41 of file ServerConnector.hpp.

Referenced by connect(), and ServerConnector().

EndPoint* samchon::protocol::ServerConnector::endPoint
protected

An endpoint directing a server.

Definition at line 46 of file ServerConnector.hpp.

Referenced by connect(), and ServerConnector().

EndPoint* samchon::protocol::ServerConnector::localEndPoint
protected

(Optional) An local endpoint of the client (my system)

An local endpoint fof my system. It binds my ip to custom. It acts when my_ip is configured. If the my_ip is not configured, does not act.

Definition at line 55 of file ServerConnector.hpp.

Referenced by connect(), and ServerConnector().


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