-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSocket.cpp
48 lines (38 loc) · 1.42 KB
/
Socket.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
/************************************************************
* File description: Socket class. creating socket, close *
* socket and method prints the errors occurs while *
* creating sockets, in all the different methods involved *
************************************************************/
#include "Socket.h"
#include <unistd.h>
#define NONE 0
/***********************************************************************
* function name: Socket *
* The Input: none *
* The output: none *
* The Function operation: creating new Socket object, with the computer*
* ip, and no port number and socket descriptor, 0 backlogs. *
***********************************************************************/
Socket::Socket() {
this->ip_address = IP;
this->backLog = NONE;
this->socketDescriptor = NONE;
this->isServer = true;
this->port_number = NONE;
}
/***********************************************************************
* function name: ~Socket *
* The Input: none *
* The output: none *
* The Function operation: default destructor *
***********************************************************************/
Socket::~Socket() {
close(this->socketDescriptor);
}
Socket::Socket(string ip) {
this->ip_address = ip;
this->backLog = NONE;
this->socketDescriptor = NONE;
this->isServer = true;
this->port_number = NONE;
}