-
Notifications
You must be signed in to change notification settings - Fork 1
/
ServerCommunication.hpp
48 lines (34 loc) · 1.03 KB
/
ServerCommunication.hpp
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* File: ServerCommunication.hpp
* Author: Jan Dufek
*/
#ifndef SERVERCOMMUNICATION_HPP
#define SERVERCOMMUNICATION_HPP
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <iostream>
#include <fstream>
#include <netdb.h>
#include <arpa/inet.h>
#include <thread>
#include "Communication.hpp"
using namespace std;
class ServerCommunication : public Communication {
public:
ServerCommunication(FotokiteState * fotokiteState, const string pipe_send, const char * ip_address, const short port_receive);
ServerCommunication(const ServerCommunication& orig);
virtual ~ServerCommunication();
void send(string);
string receive();
void close_connection();
private:
void initializeSendPipe(const string pipePath);
void initializeReceiveSocket(const char *, const short);
ofstream sendPipe;
int socket_descriptor_receive;
struct sockaddr_in socket_address_receive;
};
#endif /* SERVERCOMMUNICATION_HPP */