一款简单易用的基础网络通讯组件库。

CustomBetweenAndDataHandlingAdapterTBetweenAndRequestInfo

区间数据包处理适配器,支持以任意字符、字节数组起始与结尾的数据包。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
public abstract class CustomBetweenAndDataHandlingAdapter<TBetweenAndRequestInfo> : CustomDataHandlingAdapter<TBetweenAndRequestInfo>
where TBetweenAndRequestInfo : IBetweenAndRequestInfo
Inheritance
Object    DisposableObject    DataHandlingAdapter    SingleStreamDataHandlingAdapter    CustomDataHandlingAdapterTBetweenAndRequestInfo    CustomBetweenAndDataHandlingAdapterTBetweenAndRequestInfo

类型参数

TBetweenAndRequestInfo

[缺少 "T:TouchSocket.Core.CustomBetweenAndDataHandlingAdapter`1" 的 <typeparam name="TBetweenAndRequestInfo"/> 文档]

构造函数

CustomBetweenAndDataHandlingAdapterTBetweenAndRequestInfo初始化 CustomBetweenAndDataHandlingAdapterTBetweenAndRequestInfo 类的一个新实例

属性

CacheTimeout 缓存超时时间。默认1秒。
(继承自 SingleStreamDataHandlingAdapter。)
CacheTimeoutEnable 是否启用缓存超时。默认false。
(继承自 SingleStreamDataHandlingAdapter。)
CanSendRequestInfo 是否允许发送IRequestInfo对象。
(继承自 CustomDataHandlingAdapterTRequest。)
CanSplicingSend 默认不支持拼接发送
(继承自 CustomDataHandlingAdapterTRequest。)
DisposedValue 标识该对象是否已被释放
(继承自 DisposableObject。)
EndCode 结束字符,不可以为null,不可以为0长度,必须具有有效值。
LastCacheTime 最后缓存的时间
(继承自 SingleStreamDataHandlingAdapter。)
Logger 日志记录器。
(继承自 DataHandlingAdapter。)
MaxPackageSize 获取或设置适配器能接收的最大数据包长度。默认1024*1024 Byte。
(继承自 DataHandlingAdapter。)
MinSize 即使找到了终止因子,也不会结束,默认0
Owner 适配器所有者
(继承自 DataHandlingAdapter。)
ReceivedAsyncCallBack 当接收数据处理完成后,回调该函数执行接收
(继承自 SingleStreamDataHandlingAdapter。)
SendAsyncCallBack 当发送数据处理完成后,回调该函数执行异步发送
(继承自 SingleStreamDataHandlingAdapter。)
StartCode 起始字符,不可以为null,可以为0长度
SurLength 指示需要解析当前包的剩余长度。如果不能得知,请赋值MaxValue
(继承自 CustomDataHandlingAdapterTRequest。)
UpdateCacheTimeWhenRev 是否在收到数据时,即刷新缓存时间。默认true。
  1. 当设为true时,将弱化CacheTimeout的作用,只要一直有数据,则缓存不会过期。
  2. 当设为false时,则在CacheTimeout的时效内。必须完成单个缓存的数据。

(继承自 SingleStreamDataHandlingAdapter。)

方法

Dispose 释放资源。内部已经处理了SuppressFinalize(Object)
(继承自 DisposableObject。)
Dispose(Boolean) 处置资源
(继承自 SingleStreamDataHandlingAdapter。)
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
FilterT(T, Boolean, TBetweenAndRequestInfo, Int32) 筛选解析数据。实例化的TRequest会一直保存,直至解析成功,或手动清除。

当不满足解析条件时,请返回Cache,此时会保存CanReadLength的数据

当数据部分异常时,请移动Position到指定位置,然后返回GoOn

当完全满足解析条件时,请返回Success最后将Position移至指定位置。


(重写 CustomDataHandlingAdapterTRequestFilterTByteBlock(TByteBlock, Boolean, TRequest, Int32))
FilterTByteBlock(TByteBlock, Boolean, TRequest, Int32) 筛选解析数据。实例化的TRequest会一直保存,直至解析成功,或手动清除。

当不满足解析条件时,请返回Cache,此时会保存CanReadLength的数据

当数据部分异常时,请移动Position到指定位置,然后返回GoOn

当完全满足解析条件时,请返回Success最后将Position移至指定位置。


(继承自 CustomDataHandlingAdapterTRequest。)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(继承自 Object。)
GetHashCodeServes as the default hash function.
(继承自 Object。)
GetInstance 获取泛型实例。
GetTypeGets the Type of the current instance.
(继承自 Object。)
GoReceivedAsync 处理已经经过预先处理后的数据
(继承自 SingleStreamDataHandlingAdapter。)
GoSendAsync 异步发送已经经过预先处理后的数据
(继承自 SingleStreamDataHandlingAdapter。)
IsBeCached 判断请求对象是否应该被缓存。
(继承自 CustomDataHandlingAdapterTRequest。)
MemberwiseCloneCreates a shallow copy of the current Object.
(继承自 Object。)
OnError 在解析时发生错误。
(继承自 DataHandlingAdapter。)
OnLoaded 当适配器在被第一次加载时调用。
(继承自 DataHandlingAdapter。)
OnReceivedSuccess 成功执行接收以后。
(继承自 CustomDataHandlingAdapterTRequest。)
OnReceivingSuccess 即将执行GoReceivedAsync(ByteBlock, IRequestInfo)
(继承自 CustomDataHandlingAdapterTRequest。)
PreviewReceivedAsync 当接收到数据后预先处理数据,然后调用GoReceivedAsync(ByteBlock, IRequestInfo)处理数据
(继承自 CustomDataHandlingAdapterTRequest。)
PreviewSendAsync(IListArraySegmentByte) 组合发送预处理数据, 当属性SplicingSend实现为True时,系统才会调用该方法。
(继承自 SingleStreamDataHandlingAdapter。)
PreviewSendAsync(IRequestInfo) 当发送数据前预先处理数据
(继承自 SingleStreamDataHandlingAdapter。)
PreviewSendAsync(ReadOnlyMemoryByte) 当发送数据前预先处理数据
(继承自 SingleStreamDataHandlingAdapter。)
ReceivedInputAsync 收到数据的切入点,该方法由框架自动调用。
(继承自 SingleStreamDataHandlingAdapter。)
Reset 重置解析器到初始状态,一般在OnError(Exception, String, Boolean, Boolean)被触发时,由返回值指示是否调用。
(继承自 CustomDataHandlingAdapterTRequest。)
SendInputAsync(IListArraySegmentByte) 发送数据的切入点,该方法由框架自动调用。
(继承自 SingleStreamDataHandlingAdapter。)
SendInputAsync(IRequestInfo) 发送数据的切入点,该方法由框架自动调用。
(继承自 SingleStreamDataHandlingAdapter。)
SendInputAsync(ReadOnlyMemoryByte) 发送数据的切入点,该方法由框架自动调用。
(继承自 SingleStreamDataHandlingAdapter。)
SingleTByteBlock 处理单个字节块,提取请求对象。
(继承自 CustomDataHandlingAdapterTRequest。)
ThrowIfDisposed 判断当前对象是否已经被释放。 如果已经被释放,则抛出ObjectDisposedException异常。
(继承自 DisposableObject。)
ThrowIfMoreThanMaxPackageSize 如果指定的长度超过最大包大小,则抛出异常。
(继承自 DataHandlingAdapter。)
ToStringReturns a string that represents the current object.
(继承自 Object。)
TryParseRequestTByteBlock 尝试解析请求数据块。
(继承自 CustomDataHandlingAdapterTRequest。)

扩展方法

ConfigTouchSocketConfig中的配置,装载在SingleStreamDataHandlingAdapter上。
(由 DataHandlingAdapterExtension 定义。)
ConfigTouchSocketConfig中的配置,装载在SingleStreamDataHandlingAdapter上。
(由 DataHandlingAdapterExtension 定义。)
Map
(由 Mapper 定义。)
Map
(由 Mapper 定义。)
MapTTarget
(由 Mapper 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

参见