You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
675 B
40 lines
675 B
#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
|