Samchon Framework for CPP
1.0.0
|
An interface for a client. More...
#include <IClient.hpp>
Public Member Functions | |
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 Member Functions | |
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... | |
Protected Attributes | |
Socket * | socket |
Socket for network I/O. More... | |
std::mutex * | sendMtx |
A mutex for sending message. More... | |
An interface for a client.
IClient is an interface not only for a physical client, but also a driver for a client in a physical server.
IClient is one of the basic 3 + 1 components that can make any type of network system in Samchon Framework with IProtocol and IServer. Looking around classes in Samchon Framework, you can see all classes related with client are implemented from the IClient.
IClient takes a role of real network I/O. IClient sends data to otherside network system from IProtocol::sendData(). IClient also gets data from otherside network system, generates standard Invoke message from parsing the replied data and shift the Invoke message to IProtocol::replyData().
Definition at line 53 of file IClient.hpp.
IClient::IClient | ( | ) |
Default Constructor.
Definition at line 30 of file IClient.cpp.
|
protectedvirtual |
Buffer size of network I/O.
Definition at line 25 of file IClient.cpp.
Referenced by samchon::protocol::IWebClientBase::listen().
|
virtual |
Listens message from a related system.
Reimplemented in samchon::protocol::IWebClientBase.
Definition at line 45 of file IClient.cpp.
References samchon::WeakString::betweens(), samchon::ByteArray::getPosition(), samchon::ByteArray::read(), and samchon::ByteArray::setPosition().
Referenced by samchon::example::console_chat_server::ChatServer::addClient(), samchon::protocol::ExternalClient::start(), and samchon::protocol::ExternalServer::start().
|
virtual |
Sends message to a related system.
invoke | Invoke message to send |
Reimplemented from samchon::protocol::IProtocol.
Reimplemented in samchon::protocol::master::DistributedSystem, samchon::protocol::service::Client, and samchon::protocol::IWebClientBase.
Definition at line 309 of file IClient.cpp.
Referenced by samchon::protocol::slave::SlaveSystem::_replyData(), samchon::protocol::master::ParallelSystemArrayMediator::notifyEnd(), samchon::protocol::slave::ParallelSystem::ParallelSystem(), samchon::example::interaction::PackerMediator::replyOptimization(), samchon::protocol::ExternalSystemRole::sendData(), samchon::protocol::master::DistributedSystem::sendData(), and samchon::protocol::master::ParallelSystem::sendPieceData().
|
protectedvirtual |
A method for pre-processing replied Invoke message.
You can realize a pre-processing about the replied Invoke message by overriding the IClient::_replyData().
Archiving a history log, filtering and truncating, let handling the message with a new thread, calculating performance by estimating elapsed time about the Invoke message, and so on. Anything you can define pre-processing works before IProtocol::replyData().
invoke | An invoke message to be pre-processed and shifted to IProtocol::replyData(). |
Reimplemented in samchon::protocol::master::ParallelSystem, samchon::protocol::slave::SlaveSystem, and samchon::protocol::slave::ParallelSystem.
Definition at line 333 of file IClient.cpp.
Referenced by samchon::protocol::IWebClientBase::listen().
|
protected |
Socket for network I/O.
Definition at line 60 of file IClient.hpp.
Referenced by samchon::protocol::ExternalClientArray::addClient(), samchon::example::console_chat_server::ChatClient::ChatClient(), samchon::protocol::ServerConnector::connect(), samchon::protocol::IWebClientBase::listen(), samchon::protocol::IWebClientBase::sendData(), and samchon::protocol::service::Client::sendData().
|
protected |
A mutex for sending message.
Definition at line 65 of file IClient.hpp.
Referenced by samchon::protocol::IWebClientBase::sendData(), and samchon::protocol::service::Client::sendData().