一、使用

服务器、客户端均支持插件,使用时只需要在配置中UsePlugin,然后添加插件即可。

以服务器示例:

  1. TcpService service = new TcpService();
  2. service.AddPlugin<MyPlug1>();
  3. service.AddPlugin<MyPlug2>();
  4. //声明配置
  5. var config = new RRQMConfig();
  6. config.SetListenIPHosts(new IPHost[] { new IPHost("127.0.0.1:7789"), new IPHost(7790) }) //同时监听两个地址
  7. .UsePlugin();
  8. //载入配置
  9. service.Setup(config);
  10. //启动
  11. service.Start();

插件的添加和移除非线程安全,所以应尽量避免在运行时修改插件集合。