IService.cs 531 字节
Newer Older
1 2
using System;
using System.Threading.Tasks;
T
tanghai 已提交
3
using MongoDB.Bson;
4

T
tanghai 已提交
5
namespace Common.Network
6
{
T
tanghai 已提交
7 8 9 10 11 12
	public enum NetworkProtocol
	{
		TCP,
		UDP,
	}

13 14 15 16 17 18 19 20
	public interface IService: IDisposable
	{
		/// <summary>
		/// 将函数调用加入IService线程
		/// </summary>
		/// <param name="action"></param>
		void Add(Action action);

T
tanghai 已提交
21 22
		AChannel GetChannel(ObjectId id);

23
		Task<AChannel> GetChannel(string host, int port);
24

25
		Task<AChannel> GetChannel();
26

27
		void Remove(AChannel channel);
28

29
		void Run();
30
	}
T
tanghai 已提交
31
}