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
| #ifndef TCP_CLIENT_H
| #define TCP_CLIENT_H
|
| #include <arpa/inet.h>
| #include <netdb.h>
| #include <netinet/in.h>
| #include <stdio.h>
| #include <stdlib.h>
| #include <string.h>
| #include <sys/socket.h>
| #include <sys/types.h>
| #include <unistd.h>
|
| #include <iostream>
| #include <vector>
|
| #include "logger/log.h"
|
| using namespace std;
|
| class TCPClient
| {
| private:
| int sock;
| std::string address;
| int port;
| struct sockaddr_in server;
|
| public:
| TCPClient();
| virtual ~TCPClient();
| bool Setup(string address, int port);
| bool Send(string data);
| int Send(char* buff, int size);
| string Receive(int size);
| int Receive(char* buff, int size);
| };
|
| #endif
|
|