Samchon Framework for CPP
1.0.0
|
#include <Communicator.hpp>
Public Member Functions | |
virtual void | close () |
virtual void | replyData (std::shared_ptr< Invoke > invoke) |
virtual void | sendData (std::shared_ptr< Invoke > invoke) |
A communicator.
The Communicator is an abstract class who take full charge of network communication with remote system, without reference to whether the remote system is a server or a client. Type of the Communicator is specified to ServerConnector and ClientDriver whether the remote system is a server (that I've to connect) or a client (a client connected to my server).
Whenever a replied message comes from the remote system, the message will be converted to an Invoke class and the Invoke object will be shifted to the listener's IProtocol.replyData() method.
Note that, if one of this or remote system is web-browser based, then you don't have to use this Communicator class who follows the Samchon Framework's own protocol. Web-browser supports only Web-socket protocol. Thus in that case, you have to use WebCommunicator instead.
Definition at line 40 of file Communicator.hpp.
|
inlinevirtual |
Close connection.
Definition at line 62 of file Communicator.hpp.
|
inlinevirtual |
Handle replied message.
Handles replied Invoke message recived from remove system. The Invoke message will be shifted to the listener's IProtocol.replyData() by this method.
invoke | An Invoke message received from remote system. |
Implements samchon::protocol::IProtocol.
Definition at line 76 of file Communicator.hpp.
References samchon::protocol::IProtocol::replyData().
Referenced by samchon::protocol::WebCommunicator::sendData(), and sendData().
|
inlinevirtual |
Send message.
Send the Invoke message to remote system.
invoke | An Invoke message to send. |
Implements samchon::protocol::IProtocol.
Reimplemented in samchon::protocol::WebCommunicator.
Definition at line 92 of file Communicator.hpp.
References replyData(), and samchon::ByteArray::writeReversely().