IService.cs 546 B

1234567891011121314151617181920212223242526272829303132
  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<IChannel> GetChannel(string host, int port);
  18. Task<IChannel> GetChannel(string address);
  19. Task<IChannel> GetChannel();
  20. void Remove(IChannel channel);
  21. void RunOnce(int timeout);
  22. void Run();
  23. }
  24. }