Samchon Framework for CPP
1.0.0
|
A server connector for a physical client. More...
#include <ServerConnector.hpp>
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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
Socket * | socket |
Socket for network I/O. More... | |
std::mutex * | sendMtx |
A mutex for sending message. More... | |
Additional Inherited Members | |
![]() | |
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... | |
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.
Definition at line 32 of file ServerConnector.hpp.
ServerConnector::ServerConnector | ( | ) |
Default Constructor.
Definition at line 14 of file ServerConnector.cpp.
References endPoint, ioService, and localEndPoint.
|
pure virtual |
Destinatio IP.
Implemented in samchon::protocol::ExternalServer.
Referenced by connect().
|
pure virtual |
Destination port.
Implemented in samchon::protocol::ExternalServer.
Referenced by connect().
|
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().
|
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()).
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().
|
protected |
An io_service of Boost.Asio's own.
Definition at line 41 of file ServerConnector.hpp.
Referenced by connect(), and ServerConnector().
|
protected |
An endpoint directing a server.
Definition at line 46 of file ServerConnector.hpp.
Referenced by connect(), and ServerConnector().
|
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().