|
|
|
#ifndef _CLIENT_H
|
|
|
|
#define _CLIENT_H
|
|
|
|
|
|
|
|
#include "includes/sock.hpp"
|
|
|
|
|
|
|
|
/* Client class - Inherits from 'Sock' class - Defines a TCP/UDP client. */
|
|
|
|
|
|
|
|
class Client : public Sock {
|
|
|
|
|
|
|
|
public:
|
|
|
|
/* Default constructor - Does nothing */
|
|
|
|
Client() {};
|
|
|
|
|
|
|
|
/* Destructor - defined in client.cpp */
|
|
|
|
~Client();
|
|
|
|
|
|
|
|
/* Normal constructor that calls the parent constructor to set the given values */
|
|
|
|
Client(int ip_ver, char protocol, const char* address, int port) : Sock(ip_ver, protocol, address, port) {}
|
|
|
|
|
|
|
|
void create_socket() override;
|
|
|
|
|
|
|
|
void sendAll(std::string to_send);
|
|
|
|
|
|
|
|
char* recvAll();
|
|
|
|
|
|
|
|
/* Non-blocking receive */
|
|
|
|
char* recvAllNB();
|
|
|
|
|
|
|
|
/* Return the type of socket */
|
|
|
|
int get_type() override;
|
|
|
|
};
|
|
|
|
#endif
|