Samchon Framework for CPP  1.0.0
ChatClient.cpp
1 #include <samchon/examples/console_chat_server/ChatClient.hpp>
2 #include <samchon/examples/console_chat_server/ChatServer.hpp>
3 
4 #include <samchon/protocol/Invoke.hpp>
5 
6 using namespace std;
7 using namespace samchon::library;
8 using namespace samchon::protocol;
10 
11 ChatClient::ChatClient(ChatServer *server, Socket *socket)
12  : super()
13 {
14  this->server = server;
15  this->socket = socket;
16 }
18 {
19  server->eraseClient(this);
20 }
21 
22 void ChatClient::replyData(shared_ptr<Invoke> invoke)
23 {
24  server->replyData(invoke);
25 }
ChatServer * server
A ChatServer that the ChatClient is belonged to.
Definition: ChatClient.hpp:30
Definition: RWMutex.hpp:4
Package of libraries.
Definition: library.hpp:84
virtual void replyData(std::shared_ptr< protocol::Invoke >) override
Handling replied message.
Definition: ChatServer.cpp:31
Package of network protocol and libraries.
Definition: protocol.hpp:185
An interface for a client.
Definition: IClient.hpp:53
Socket * socket
Socket for network I/O.
Definition: IClient.hpp:60
void eraseClient(ChatClient *client)
Erase client when disconnected.
Definition: ChatServer.cpp:25
virtual void replyData(std::shared_ptr< protocol::Invoke >) override
Shift responsibility to related chain.
Definition: ChatClient.cpp:22
virtual ~ChatClient()
Default Destructor.
Definition: ChatClient.cpp:17