-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (34 loc) · 813 Bytes
/
main.cpp
File metadata and controls
35 lines (34 loc) · 813 Bytes
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
#include "Server/server.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
int main(int ac, char **av)
{
try{
if (ac != 3)
{
std::cout << "Too few Arguments" << std::endl;
return 1;
}
signal(SIGPIPE, SIG_IGN);
// signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
size_t port = std::atoi(av[1]);
if (port < 1024 || port > 65535)
{
std::cerr << "You are Not On the Right RAnge Of Allowed Port" << std::endl;
return 1;
}
Server sr(port, av[2]);
sr.ServerStarting();
}
catch(...)
{
std::cout << "Error" << std::endl;
}
}