-
Notifications
You must be signed in to change notification settings - Fork 5
/
Packet.cpp
executable file
·68 lines (54 loc) · 946 Bytes
/
Packet.cpp
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
60
61
62
63
64
65
66
67
68
/*
* Packet.cpp
*
* Created on: Nov 11, 2015
* Author: Irtiza
*/
#ifndef __Bean_h
#define __Bean_h
#include <string>
using namespace std;
struct Packet {
public:
//int a,b;
int port, chunk;
int last;
char file[10];
static const int size = 1000;
char message[size];
Packet() {
port=0;
chunk=0;
last=0;
setFile("");
setMessage("");
}
Packet(const Packet& a) {
// this->a=a.a;
// this->b=a.b;
last = a.last;
port = a.port;
chunk = a.chunk;
setFile(a.file);
setMessage(a.message);
}
void operator=(Packet a) {
// this->a=a.a;
// this->b=a.b;
port = a.port;
chunk = a.chunk;
setFile(a.file);
setMessage(a.message);
last = a.last;
}
void setMessage(string mesg) {
strcpy(message, mesg.c_str());
}
void setFile(string mesg) {
// for (int i = 0; i < mesg.size(); i++) {
//if((message[i]>="A")and (message[i]<="z"))
strcpy(file, mesg.c_str());
}
//}
};
#endif /* __Bean*/