-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
64 lines (55 loc) · 1.57 KB
/
Program.cs
File metadata and controls
64 lines (55 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
using App.Handle;
using App.Schedule;
using Newtonsoft.Json;
using Simple.BasicNet.Core;
using Simple.BasicNet.Core.Handle;
using Simple.BasicNet.Core.Net;
using System.Threading;
public class Program
{
private static ManualResetEvent mre = new ManualResetEvent(false);
public static int Main(string[] args)
{
IHost host= Host.BuilderHost().Regster((contain) =>
{
//容器模块,注册需要实例的对象,容器可以自动创建对象,解决对象的依赖。
}).
RegisterSchedule((scheduleManager) =>
{
//注册任务
//任务是固定时间间隔执行
//一个任务周期为 任务中逻辑时间+等待时间
//通常任务时间比较少,适合做心跳检查
scheduleManager.Register<TestSchedule>();
scheduleManager.Register<CheckHeartSchedule>();
}).Start((configution) =>
{
configution.Port = 1234;
configution.Backlog = 200;
configution.ProtocolType=System.Net.Sockets.ProtocolType.Tcp;
configution.SetIpAddress("172.16.1.128");
configution.SocketType = System.Net.Sockets.SocketType.Stream;
});
Console.ReadLine();
//Type type=typeof(AHandle);
//FindBaseHandleChildren find = new FindBaseHandleChildren();
//while (true)
//{
// string strCommand = Console.ReadLine();
// int.TryParse(strCommand,out int number);
// find.Find(number);
// if (number==0)
// {
// break;
// }
//}
return 0;
}
private static void ThreadProc()
{
string name = Thread.CurrentThread.Name;
Console.WriteLine(name + " starts and calls mre.WaitOne()");
mre.WaitOne();
Console.WriteLine(name + " ends.");
}
}