Files
2023-10-13 14:01:41 +00:00

40 lines
675 B
C++

#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