-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathTcpConnection.h
39 lines (34 loc) · 976 Bytes
/
TcpConnection.h
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
//author voidccc
#ifndef TCPCONNECTION_H
#define TCPCONNECTION_H
#include "Declear.h"
#include "IChannelCallback.h"
#include "Buffer.h"
#include "IRun.h"
#include <string>
using namespace std;
class TcpConnection : public IChannelCallback
, public IRun0
, public IRun2
{
public:
TcpConnection(int sockfd, EventLoop* pLoop);
~TcpConnection();
void send(const string& message);
void sendInLoop(const string& message);
void connectEstablished();
void setUser(IMuduoUser* pUser);
void setCallback(IAcceptorCallback* pCallback);
virtual void handleRead();
virtual void handleWrite();
virtual void run0();
virtual void run2(const string& message, void* param);
private:
int _sockfd;
Channel* _pSocketChannel;
EventLoop* _pLoop;
IMuduoUser* _pUser;
Buffer _inBuf;
Buffer _outBuf;
};
#endif