IService.cs 563 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Threading.Tasks;
  3. using MongoDB.Bson;
  4. namespace Common.Network
  5. {
  6. public enum NetworkProtocol
  7. {
  8. TCP,
  9. UDP,
  10. }
  11. public interface IService: IDisposable
  12. {
  13. /// <summary>
  14. /// 将函数调用加入IService线程
  15. /// </summary>
  16. /// <param name="action"></param>
  17. void Add(Action action);
  18. AChannel GetChannel(ObjectId id);
  19. Task<AChannel> GetChannel(string host, int port);
  20. Task<AChannel> GetChannel();
  21. void Remove(AChannel channel);
  22. void RunOnce(int timeout);
  23. void Run();
  24. }
  25. }