IService.cs 496 B

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