Samchon Framework for CPP  1.0.0
samchon::protocol::Communicator Class Reference

#include <Communicator.hpp>

Collaboration diagram for samchon::protocol::Communicator:

Public Member Functions

virtual void close ()
virtual void replyData (std::shared_ptr< Invoke > invoke)
virtual void sendData (std::shared_ptr< Invoke > invoke)

Detailed Description

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.

Basic Components
See also
ClientDriver, ServerConnector, IProtocol Protocol - Basic Components
Jeongho Nam

Definition at line 40 of file Communicator.hpp.

Member Function Documentation

virtual void samchon::protocol::Communicator::close ( )

Close connection.

Definition at line 62 of file Communicator.hpp.

virtual void samchon::protocol::Communicator::replyData ( std::shared_ptr< Invoke invoke)

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.

invokeAn 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().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void samchon::protocol::Communicator::sendData ( std::shared_ptr< Invoke invoke)

Send message.

Send the Invoke message to remote system.

invokeAn 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().

Here is the call graph for this function:

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