summaryrefslogtreecommitdiffstats
path: root/src/client/ClientBase.hpp
blob: 425929faaaf0876984e037bc9b14e97305d4fc51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef WC_CLIENTBASE_H
#define WC_CLIENTBASE_H

#include "../const_vars.hpp"

class ClientBase {
protected:
	int fd;
	char in_buffer[max_usermsg_len]; // for input
	int in_buf_used;

	char out_buffer[max_msg_len]; // for message
	int out_buf_used;

	bool exit_flag;
public:
	ClientBase(const char* ip, int port);
	virtual ~ClientBase();
	int ConstuctorError() const { return fd > -1 ? 0 : 1; }

	int Run();
	virtual void HandleActions() {}
	virtual void ShowMessage(const char *msg) {}
private:
	int CreateSocket(const char* ip, int port);
};

#endif