Class ClientFrameList
Namespace: Tool.Sockets.NetFrame
Assembly: Tool.Net.dll
用于连接多服务器,分发消息的客户端帮助类,可以保证线程安全,均衡分发数据包。
public class ClientFrameList : IDisposableInheritance
Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Extension Methods
ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)
Remarks
代码由逆血提供支持
Constructors
ClientFrameList(IList<ClientFrame>)
初始化一次性加入队列服务器
public ClientFrameList(IList<ClientFrame> clientFrames)Parameters
clientFrames IList<ClientFrame>
队列服务器
ClientFrameList(IEnumerable<ClientFrame>)
初始化一次性加入队列服务器
public ClientFrameList(IEnumerable<ClientFrame> clientFrames)Parameters
clientFrames IEnumerable<ClientFrame>
队列服务器
ClientFrameList(params ClientFrame[])
初始化一次性加入队列服务器
public ClientFrameList(params ClientFrame[] clientFrames)Parameters
clientFrames ClientFrame[]
队列服务器
ClientFrameList(int)
初始化 可为空
public ClientFrameList(int capacity)Parameters
capacity int
默认大小
Properties
ClientCount
当前拥有的队列数
public int ClientCount { get; }Property Value
this[int]
返回加入的ClientFrame对象
public ClientFrame this[int i] { get; }Property Value
Methods
AddClientFrame(ClientFrame)
主动添加客户端服务
public void AddClientFrame(ClientFrame clientFrame)Parameters
clientFrame ClientFrame
客户端
Dispose()
回收连接对象池,释放相关的全部连接
public void Dispose()Reconnection(int)
重连,返回是否重连,如果没有断开是不会重连的
public Task<bool> Reconnection(int i)Parameters
i int
要重连的下标
Returns
Send(ApiPacket, out int)
同步发送消息(多服务器协调发送)
public NetResponse Send(ApiPacket api, out int i)Parameters
api ApiPacket
接口调用信息
i int
返回成功发送包的下标
Returns
返回数据包
Send(int, ApiPacket)
同步发送消息(多服务器协调发送)
public NetResponse Send(int i, ApiPacket api)Parameters
i int
向那个服务器端口发包
api ApiPacket
接口调用信息
Returns
返回数据包
SendAsync(ApiPacket)
异步发送消息(多服务器协调发送)
public ValueTask<(NetResponse, int i)> SendAsync(ApiPacket api)Parameters
api ApiPacket
接口调用信息
Returns
ValueTask<(NetResponse, int i)>
返回数据包,以及下标
SendAsync(int, ApiPacket)
异步发送消息(多服务器协调发送)
public ValueTask<NetResponse> SendAsync(int i, ApiPacket api)Parameters
i int
向那个服务器端口发包
api ApiPacket
接口调用信息
Returns
SendRelay(string, ApiPacket, out int)
同步发送消息(多服务器协调发送+转发给指定客户端)
public NetResponse SendRelay(string IpPort, ApiPacket api, out int i)Parameters
IpPort string
事件处理的服务器
api ApiPacket
接口调用信息
i int
返回成功发送包的下标
Returns
返回数据包
SendRelayAsync(string, ApiPacket)
异步发送消息(多服务器协调发送+转发给指定客户端)
public ValueTask<(NetResponse, int i)> SendRelayAsync(string IpPort, ApiPacket api)Parameters
IpPort string
事件处理的服务器
api ApiPacket
接口调用信息
Returns
ValueTask<(NetResponse, int i)>
返回数据包,以及下标
Completed
绑定多服务器队列统一消息
public event CompletedEvent<EnClient> Completed