Files
netpong/includes/client.hpp
Rockingcool 0058e7e411 Removed ip_ver parameter
I removed this because I realized I could just check the IP version inside
the constructor. The Sock constructor now checks the address passed to it.
Like before, if the address is neither v4 nor v6, an exception is thrown.
Since the Server and Client constructors call the Sock constructor, no change
was required in these files, except passing the right number of parameters.
2024-03-10 21:53:06 -05:00

33 lines
677 B
C++

#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(char protocol, const char* address, int port) : Sock(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