IService.cs 583 B

1234567891011121314151617181920212223242526272829303132333435
  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 Start();
  24. void Stop();
  25. }
  26. }