-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.h
More file actions
81 lines (51 loc) · 1.56 KB
/
server.h
File metadata and controls
81 lines (51 loc) · 1.56 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include <iostream>
//For Winsock
#include <string>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <Windows.h>
//This is for file reading and writing
#include <fstream>
//Macro
//This is the port number which the client number connect to
#define DEFAULT_PORT "27015"
class server
{
public:
server();
~server();
private:
//WSADATA contains information about Windows socket Implementation
WSADATA wsaData;
// This is the function to initialise winsock
int init_winsock();
int init_getaddrinfo();
// This struct addrinfo is used by the getaddrinfo
struct addrinfo *result = NULL, *prt = NULL, hints;
//This SOCKET object is for the server to listen for the client connections.
SOCKET listen_sock = INVALID_SOCKET;
// This function calls the socket function and ensures a valid socket
int init_socket();
//This function is called to bind the socket to an address
int bind_socket();
//This would create a wrapper on the listen function
int listen_socket();
//This would accept the connection
int accept_connection();
//This is the client socket
SOCKET client_sock = INVALID_SOCKET;
//This would show the port (Extra)
void port_view();
//This stores the url in a string (Extra)
std::string url;
//This would open the port in a browser(Extra)
void port_open();
//This is the loading animation(Extra)
void loading_animation();
//These would hide and show the cursor(Extra)
void hideCursor();
void showCursor();
//This function would create functionality to send data
int send_data();
};