-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
75 lines (59 loc) · 1.57 KB
/
Copy pathProgram.cs
File metadata and controls
75 lines (59 loc) · 1.57 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
using System;
namespace BinaryPacketServer;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello SuperSocketLite");
var server = new Server();
server.Start();
Console.WriteLine("key를 누르면 종료한다....");
Console.ReadKey();
}
}
class Server
{
System.Timers.Timer workProcessTimer;
public void Start()
{
var server = new MainServer();
server.InitConfig();
server.CreateServer();
var IsResult = server.Start();
if (IsResult)
{
DevLog.Write(string.Format("서버 네트워크 시작"), LOG_LEVEL.INFO);
}
else
{
DevLog.Write(string.Format("[ERROR] 서버 네트워크 시작 실패"), LOG_LEVEL.ERROR);
return;
}
workProcessTimer = new System.Timers.Timer(32);
workProcessTimer.Elapsed += OnProcessTimedEvent;
workProcessTimer.AutoReset = true;
workProcessTimer.Enabled = true;
}
void OnProcessTimedEvent(object sender, EventArgs e)
{
// 너무 이 작업만 할 수 없으므로 일정 작업 이상을 하면 일단 패스한다.
int logWorkCount = 0;
while (true)
{
string msg;
if (DevLog.GetLog(out msg))
{
++logWorkCount;
Console.WriteLine(msg);
}
else
{
break;
}
if (logWorkCount > 7)
{
break;
}
}
}
}