-
Notifications
You must be signed in to change notification settings - Fork 1
/
transmit.h
executable file
·60 lines (45 loc) · 1.27 KB
/
transmit.h
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
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _TRANSMIT_H
#define _TRANSMIT_H
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fstream>
#include <sstream>
#include "model.h"
#include "strtokenizer.h"
#include "constants.h"
#include "socket.h"
using namespace std;
class transmit : private socket {
public:
transmit(const int port) : socket(port) {
if (!socket::socketEstablish())
throw SocketException("Could not create server socket");
if (!socket::socketBind())
throw SocketException("Could not bind to port");
if (!socket::socketListen())
throw SocketException("Could not listen to socket");
}
transmit() {}
~transmit() {}
const transmit& operator << (const string& str) const;
const transmit& operator >> (string& str) const;
void accept(transmit& clt);
void SendFile(const vector<string>& info);
void SendStruct(string arg);
void SetContent(struct MovieData &movie, vector<string>& arg);
void setPort(int p) {
socket::setPort(p);
}
void close();
};
#endif