-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconn.h
More file actions
36 lines (31 loc) · 695 Bytes
/
conn.h
File metadata and controls
36 lines (31 loc) · 695 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
#ifndef _CONN_H
#define _CONN_H
#include <arpa/inet.h>
#include "fdwrapper.h"
class conn
{
public:
conn();
~conn();
void init_clt(int sockfd,const sockaddr_in& client_addr);
void init_srv(int sockfd,const sockaddr_in& serve_addr);
void reset();
RET_CODE read_clt();
RET_CODE write_clt();
RET_CODE read_srv();
RET_CODE write_srv();
public:
static const int BUF_SIZE = 2048;
char *m_clt_buf;
int m_clt_read_idx;
int m_clt_write_idx;
sockaddr_in m_clt_address;
int m_cltfd;
char *m_srv_buf;
int m_srv_read_idx;
int m_srv_write_idx;
sockaddr_in m_srv_address;
int m_srvfd;
bool m_srv_closed;
};
#endif