-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTcpChatClient.h
More file actions
46 lines (37 loc) · 1018 Bytes
/
TcpChatClient.h
File metadata and controls
46 lines (37 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* =====================================================================================
*
* Filename: TcpChatClient.h
*
* Description: Chat client based on TCP
*
* Version: 1.0
* Created: 04/09/17 20:24:36
* Revision: 0.1 - Creation
* Compiler: g++
*
* Author: Feng Jie<[email protected]>
*
* =====================================================================================
*/
#ifndef __TCPCHATCLIENT_H
#define __TCPCHATCLIENT_H
#include "BaseSocketClient.h"
#include "utils/Mutex.h"
#define MAX_BUF_SIZE 512
class TcpChatClient : public BaseSocketClient {
public:
TcpChatClient(const char *remote, int port);
~TcpChatClient() {}
virtual bool start();
protected:
bool prepare();
bool onSend(std::string &s);
bool onReceive(std::string &s);
private:
static void *send_handler(void *arg);
static void *recv_handler(void *arg);
Mutex mUiLock;
int mConnSock;
};
#endif /* __TCPCHATCLIENT_H */