一、使用
服务器、客户端均支持插件,使用时只需要在配置中UsePlugin,然后添加插件即可。
以服务器示例:
TcpService service = new TcpService();
service.AddPlugin<MyPlug1>();
service.AddPlugin<MyPlug2>();
//声明配置
var config = new RRQMConfig();
config.SetListenIPHosts(new IPHost[] { new IPHost("127.0.0.1:7789"), new IPHost(7790) }) //同时监听两个地址
.UsePlugin();
//载入配置
service.Setup(config);
//启动
service.Start();
插件的添加和移除非线程安全,所以应尽量避免在运行时修改插件集合。