mcping/Connection.h

40 lines
544 B
C++

#ifndef CONNECTION_H
#define CONNECTION_H
#include <string>
#include <vector>
#include "Payload.h"
class Payload;
class Connection
{
private:
int fd;
enum class ErrorTypes{
none = 0,
socket_creation = 10,
get_ip,
connect,
}error;
void p_HandleError();
public:
Connection(std::string server_ip, int port);
~Connection();
bool send(std::vector<Payload> payload);
Payload recv();
/**
* Return the error code from the last command if there is one
* @return error_code
*/
int status();
};
#endif /* CONNECTION_H */