My Project
client.hpp
Go to the documentation of this file.
1#ifndef _CLIENT_HPP
2#define _CLIENT_HPP
3
4#include "wordle-de.pb.h"
5#include <arpa/inet.h>
6#include <functional>
7#include <string>
8
9#define INPUT_BUFFER_SIZE 1000
10class Client {
11 int sock;
12 sockaddr_in serverAddr;
14 typedef std::function<void(uint16_t fd, char *)> receiveCallbackType;
15
16public:
17 Client();
18 Client(const std::string &, const int &);
19 void connectToServer();
21 uint16_t sendMessage(const char *);
22 wordle_de::Message receiveMessage();
23
24 // void onInput(receiveCallbackType cb) { receiveCallback = cb; }
25
26 // private:
27 // receiveCallbackType receiveCallback;
28};
29#endif // !_CLIENT_HPP
Definition: client.hpp:10
sockaddr_in serverAddr
Definition: client.hpp:12
uint16_t sendMessage(const char *)
Definition: client.cpp:37
char inputBuffer[INPUT_BUFFER_SIZE]
Definition: client.hpp:13
void disconnectFromServer()
Definition: client.cpp:35
void connectToServer()
Definition: client.cpp:27
wordle_de::Message receiveMessage()
Definition: client.cpp:41
int sock
Definition: client.hpp:11
std::function< void(uint16_t fd, char *)> receiveCallbackType
Definition: client.hpp:14
Client()
Definition: client.cpp:8
#define INPUT_BUFFER_SIZE
Definition: client.hpp:9