Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Jun 10, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
Latest commit
57 lines (49 loc) · 1.38 KB
/
Copy pathProgram.cs
File metadata and controls
57 lines (49 loc) · 1.38 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
usingSystem;
usingSystem.Linq;
usingSystem.Net;
usingSystem.Net.Sockets;
usingSystem.Reflection;
usingSystem.Text;
usingSystem.Threading;
usingMicrosoft.Extensions.Logging;
usingSerilog;
usingTheP0ngServer.Models;
usingTheP0ngServer.ProtocolManagers;
namespaceTheP0ngServer
{
publicclassProgram
{
staticvoidMain(string[]args)
{
intport=Configs.Port;
intgameServicePort=Configs.GameServicePort;
stringschoolCode=Configs.SchoolCode;
stringapiDomain=Configs.GameServiceIP;
LoggerServicelogger=newLoggerService();
logger.LogInformation($"Started Server on Port: {port}, Connecting to: {apiDomain}, where SchoolCode: {schoolCode}");
//Starts TCP on a new thread and a new thread for UDP and tcp branches have new threads for handling new clients;
try
{
ThreadudpThread=newThread(()=>UdpListener.StartUdpListening(port,apiDomain,gameServicePort));
udpThread.Start();
}
catch(Exceptionexception)
{
logger.LogError($"Error with udpThread: {exception}");
}
try
{
ThreadtcpThread=newThread(()=>TcpManager.StartTcpServer(port,apiDomain,schoolCode));
tcpThread.Start();
}
catch(Exceptionexception)
{
logger.LogError($"Error with tcpThread: {exception}");
}
finally
{
logger.CloseLogger();
}
}
}
}