-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequest.cpp
More file actions
51 lines (45 loc) · 1.3 KB
/
Copy pathRequest.cpp
File metadata and controls
51 lines (45 loc) · 1.3 KB
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
#include "Request.hpp"
Request::Request()
{
clientSize = sizeof(clientAddress);
std::cout << "New Default Request created" << std::endl;
}
// Request::Request(int servSckt)
// {
// servSocket = servSckt;
// std::cout << "New Request created with server socket: " << servSocket << std::endl;
// }
Request::Request(Request const & src)
: clientAddress(src.clientAddress), clientSize(src.clientSize), clientSocket(src.clientSocket), clientPort(src.clientPort), servSocket(src.servSocket)
{
for (size_t i = 0; i < INET_ADDRSTRLEN; i++)
{
clientIP[i] = src.clientIP[i];
}
std::cout << "Request copy constructor called." << std::endl;
}
Request& Request::operator=(Request const & rhs)
{
std::cout << "Request assignment constructor called." << std::endl;
if(this != &rhs)
{
clientAddress = rhs.clientAddress;
clientSize = rhs.clientSize;
clientSocket = rhs.clientSocket;
for (size_t i = 0; i < INET_ADDRSTRLEN; i++)
{
clientIP[i] = rhs.clientIP[i];
}
clientPort = rhs.clientPort;
servSocket = rhs.servSocket;
}
return(*this);
}
bool Request::operator<(const Request& other) const
{
return(clientSocket < other.clientSocket);
}
Request::~Request()
{
std::cout << "Request destructor called." << std::endl;
}