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

HttpDmtpSessionClient 类

抽象类 HttpDmtpSessionClient 继承自 HttpSessionClient,并实现 IHttpDmtpSessionClient 接口。 该类提供了与 HTTP DMTP 协议相关的会话客户端功能。

Definition

命名空间: TouchSocket.Dmtp
程序集: TouchSocket.Dmtp (在 TouchSocket.Dmtp.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
public abstract class HttpDmtpSessionClient : HttpSessionClient, 
	IHttpDmtpSessionClient, IHttpSessionClient, IHttpSession, ITcpSession, IClient, 
	IDependencyObject, IDisposableObject, IDisposable, ILoggerObject, IResolverConfigObject, 
	IConfigObject, IPluginObject, IResolverObject, IOnlineClient, IClosableClient, 
	ISessionClient, IIdClient, ITcpListenableClient, IDmtpActorObject
Inheritance
Object    DisposableObject    DependencyObject    ConfigObject    ResolverConfigObject    TcpSessionClientBase    HttpSessionClient    HttpDmtpSessionClient
Implements
IDisposable, IConfigObject, IDependencyObject, IDisposableObject, ILoggerObject, IPluginObject, IResolverConfigObject, IResolverObject, IDmtpActorObject, IHttpDmtpSessionClient, IHttpSession, IHttpSessionClient, IClient, IClosableClient, IIdClient, IOnlineClient, ISessionClient, ITcpListenableClient, ITcpSession

构造函数

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

属性

Config 配置项
(继承自 TcpSessionClientBase。)
DataHandlingAdapter 数据处理适配器
(继承自 TcpSessionClientBase。)
DisposedValue 标识该对象是否已被释放
(继承自 DisposableObject。)
DmtpActor 提供Dmtp协议的最基础功能件
Id 用于索引的Id
(继承自 TcpSessionClientBase。)
IP IP地址
(继承自 TcpSessionClientBase。)
IsClient 表示是否为客户端终端。当为时,表示是客户端。否则为服务器通讯终端。
(继承自 TcpSessionClientBase。)
LastReceivedTime 最后一次接收到数据的时间
(继承自 TcpSessionClientBase。)
LastSentTime 最后一次发送数据的时间
(继承自 TcpSessionClientBase。)
ListenOption 监听配置。

注意:一般情况下不要随意修改该值。


(继承自 TcpSessionClientBase。)
Logger 日志记录器
(继承自 ConfigObject。)
MainSocket 主通信器
(继承自 TcpSessionClientBase。)
Online 判断是否在线
(重写 TcpSessionClientBaseOnline)
PluginManager 插件管理器
(继承自 TcpSessionClientBase。)
Port 端口号
(继承自 TcpSessionClientBase。)
Protocol 终端协议
(继承自 TcpSessionClientBase。)
Resolver 获取解析器实例。
(继承自 TcpSessionClientBase。)
Service 包含此辅助类的主服务器类
(继承自 TcpSessionClientBase。)
ServiceIP 接收此客户端的服务器IP地址
(继承自 TcpSessionClientBase。)
ServicePort 接收此客户端的服务器端口
(继承自 TcpSessionClientBase。)
UseSsl 使用Ssl加密
(继承自 TcpSessionClientBase。)
VerifyTimeout 验证超时时间
VerifyToken 连接令箭
WebSocket 当该连接是WebSocket时,可获取该对象,否则为null。
(继承自 HttpSessionClient。)

方法

Abort 中止当前操作。
(继承自 TcpSessionClientBase。)
CloneTo 将当前对象的依赖项克隆到目标对象中
(继承自 DependencyObject。)
CloseAsync 关闭客户端。
(重写 TcpSessionClientBaseCloseAsync(String))
Dispose 释放资源。内部已经处理了SuppressFinalize(Object)
(继承自 DisposableObject。)
Dispose(Boolean) 处置资源
(重写 HttpSessionClientDispose(Boolean))
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
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。)
GetTypeGets the Type of the current instance.
(继承自 Object。)
GetValueTValue 获取依赖注入的值,当没有注入时,会返回默认行为的值。
(继承自 DependencyObject。)
HasValueTValue 判断在当前对象中是否有已设置的属性值。
(继承自 DependencyObject。)
IdChanged 当Id更新的时候触发
(继承自 TcpSessionClientBase。)
MemberwiseCloneCreates a shallow copy of the current Object.
(继承自 Object。)
OnCreatedChannel 当创建通道时触发的事件处理程序
OnDmtpClosed 当Dmtp关闭以后。
OnDmtpClosing 当Dmtp即将被关闭时触发。

该触发条件有2种:

  1. 终端主动调用CloseAsync(String)
  2. 终端收到P0_Close的请求。

OnHandshaked 在完成握手连接时
OnHandshaking 在验证Token时
OnInitialized 当初始化完成时,执行在OnTcpConnecting(ConnectingEventArgs)之前。
(继承自 TcpSessionClientBase。)
OnReceivedHttpRequest 当收到到Http请求时。覆盖父类方法将不会触发插件。
(重写 HttpSessionClientOnReceivedHttpRequest(HttpContext))
OnRouting 当需要转发路由包时。
OnTcpClosed 客户端已断开连接。

覆盖父类方法,将不会触发ITcpClosedPlugin插件。


(重写 HttpSessionClientOnTcpClosed(ClosedEventArgs))
OnTcpClosing 即将断开连接(仅主动断开时有效)。

覆盖父类方法,将不会触发ITcpClosingPlugin插件。


(重写 TcpSessionClientBaseOnTcpClosing(ClosingEventArgs))
OnTcpConnected 当客户端完整建立Tcp连接时触发。

覆盖父类方法,将不会触发ITcpConnectedPlugin插件。


(继承自 TcpSessionClientBase。)
OnTcpConnecting 客户端正在连接。

覆盖父类方法,将不会触发ITcpConnectingPlugin插件。


(继承自 HttpSessionClient。)
OnTcpReceived 当收到适配器处理的数据时。
(重写 HttpSessionClientOnTcpReceived(ReceivedDataEventArgs))
OnTcpReceiving 当收到原始数据
(继承自 TcpSessionClientBase。)
OnTcpSending 在数据即将通过TCP发送时触发,此方法用于通过插件机制拦截发送行为。 如果子类覆盖了此方法,则不会触发插件。
(继承自 TcpSessionClientBase。)
OnWebSocketClosed 虚拟异步方法:处理WebSocket关闭事件
(继承自 HttpSessionClient。)
OnWebSocketClosing 调用前触发WebSocket关闭时的插件
(继承自 HttpSessionClient。)
OnWebSocketHandshaked 当WebSocket握手成功时,触发相关插件的异步事件。
(继承自 HttpSessionClient。)
OnWebSocketHandshaking 在WebSocket握手过程中触发插件执行异步任务
(继承自 HttpSessionClient。)
OnWebSocketReceived 虚拟异步方法:当WebSocket接收到数据时触发
(继承自 HttpSessionClient。)
ProtectedClearReceiver 清除接收器对象。
(继承自 TcpSessionClientBase。)
ProtectedCreateReceiver 创建或获取接收器对象。
(继承自 TcpSessionClientBase。)
ProtectedDefaultSendAsync 异步发送数据,保护方法。 此方法用于在已建立的TCP连接上异步发送数据。 它首先检查当前实例是否已被处置,然后检查客户端是否已连接。 如果这些检查通过,它将调用OnTcpSending事件处理程序进行预发送处理, 最后通过TCP核心组件实际发送数据。
(继承自 TcpSessionClientBase。)
ProtectedResetIdAsync 直接重置内部Id。
(继承自 TcpSessionClientBase。)
ProtectedSendAsync(IListArraySegmentByte) 异步发送字节传输列表。
(继承自 TcpSessionClientBase。)
ProtectedSendAsync(IRequestInfo) 异步发送请求信息。
(继承自 TcpSessionClientBase。)
ProtectedSendAsync(ReadOnlyMemoryByte) 异步发送只读内存数据。
(继承自 TcpSessionClientBase。)
ProtectedTryGetClient 尝试通过Id获得对应的客户端
(继承自 TcpSessionClientBase。)
RemoveValueTValue 移除属性值。
(继承自 DependencyObject。)
ResetIdAsync 重新设置Id
(重写 TcpSessionClientBaseResetIdAsync(String))
SetAdapter 设置数据处理适配器。
(继承自 TcpSessionClientBase。)
SetValueTValue 设置依赖注入的值,如果值已经存在,将被覆盖。
(继承自 DependencyObject。)
SwitchProtocolToWebSocketAsync 转化Protocol协议标识为WebSocket
(继承自 HttpSessionClient。)
ThrowIfConfigIsNull 如果Config为空,则抛出ArgumentNullException的异常。
(继承自 ConfigObject。)
ThrowIfDisposed 判断当前对象是否已经被释放。 如果已经被释放,则抛出ObjectDisposedException异常。
(继承自 DisposableObject。)
ToStringReturns a string that represents the current object.
(继承自 Object。)
TryGetValueTValue 尝试获取依赖注入的值,当没有注入时,会返回
(继承自 DependencyObject。)
TryRemoveValueTValue 尝试重置属性值,如果没有这个值,则返回
(继承自 DependencyObject。)

扩展方法

ChannelExisted 判断指定Id的通道是否已经存在
(由 DmtpActorExtension 定义。)
CloseWithTLV 使用TLV格式关闭TCP会话
(由 TLVClientExtensions 定义。)
CloseWithTLVAsync 发送TLV的Close报文,然后关闭当前客户端
(由 TLVClientExtensions 定义。)
CreateChannel 在当前对点创建一个随机Id的通道
(由 DmtpActorExtension 定义。)
CreateChannel 在当前对点创建一个指定Id的通道
(由 DmtpActorExtension 定义。)
CreateChannel 在指定路由点创建一个随机Id的通道
(由 DmtpActorExtension 定义。)
CreateChannel 在指定路由点创建一个指定Id的通道
(由 DmtpActorExtension 定义。)
CreateChannelAsync 在当前对点创建一个随机Id的通道
(由 DmtpActorExtension 定义。)
CreateChannelAsync 在当前对点创建一个指定Id的通道
(由 DmtpActorExtension 定义。)
CreateChannelAsync 在指定路由点创建一个随机Id的通道
(由 DmtpActorExtension 定义。)
CreateChannelAsync 在指定路由点创建一个指定Id的通道
(由 DmtpActorExtension 定义。)
CreateTargetDmtpRpcActor 新创建一个直接向目标地址请求的IRpcClient客户端。
(由 DmtpRpcActorExtension 定义。)
GetDmtpFileTransferActorIDmtpActorObject中获取能实现文件传输的IDmtpFileTransferActor
(由 DmtpFileTransferActorExtension 定义。)
GetDmtpRedisActor 获取IDmtpRedisActor
(由 DmtpRedisActorExtensions 定义。)
GetDmtpRemoteStreamActorIDmtpActorObject中获取IDmtpRemoteStreamActor
(由 DmtpRemoteStreamExtension 定义。)
GetDmtpRouterPackageActorIDmtpActorObject中获取IDmtpRouterPackageActor
(由 DmtpRouterPackageExtension 定义。)
GetDmtpRpcActorIDmtpActorObject中获取IDmtpRpcActor,以实现Rpc调用功能。
(由 DmtpRpcActorExtension 定义。)
GetDmtpRpcActorTDmtpRpcActorIDmtpActorObject中获取继承实现IDmtpRpcActor的功能件,以实现Rpc调用功能。
(由 DmtpRpcActorExtension 定义。)
GetJsonRpcActionClient 获取基于Tcp协议或者WebSocket协议的双工JsonRpc端
(由 JsonRpcClientExtension 定义。)
GetRemoteAccessActor 获取远程访问的IDmtpRemoteAccessActor
(由 DmtpRemoteAccessExtension 定义。)
Map
(由 Mapper 定义。)
Map
(由 Mapper 定义。)
MapTTarget
(由 Mapper 定义。)
Ping 向当前对点发送一个Ping报文,并且等待回应。
(由 DmtpActorExtension 定义。)
Ping 向指定路由点发送一个Ping报文,并且等待回应。
(由 DmtpActorExtension 定义。)
PingAsync 向当前对点发送一个Ping报文,并且等待回应。
(由 DmtpActorExtension 定义。)
PingAsync 向指定路由点发送一个Ping报文,并且等待回应。
(由 DmtpActorExtension 定义。)
PingWithTLV 发送Tag为Ping的报文,然后等待Pong回应。

当适配器不是TLVDataHandlingAdapter时,会抛出异常。


(由 TLVClientExtensions 定义。)
SafeDispose 安全性释放(不用判断对象是否为空)。不会抛出任何异常。

内部会判断DisposedValue的值,如果为,则不会再执行Dispose


(由 SystemExtension 定义。)
SafeDispose 安全性释放(不用判断对象是否为空)。不会抛出任何异常。
(由 SystemExtension 定义。)
SendAsync 异步发送空数据
(由 DmtpActorExtension 定义。)
SendAsync 异步发送估计大小小于64K的IPackage。 此方法重载允许指定自定义最大传输单元大小。
(由 DmtpActorExtension 定义。)
SendAsync 异步发送数据
(由 DmtpActorExtension 定义。)
SendAsync 异步发送数据包。 此方法扩展了IDmtpActorObject接口,使其具有发送数据包的能力。
(由 DmtpActorExtension 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)
TrySendAsync 异步尝试发送数据给指定的客户端。
(由 DmtpActorExtension 定义。)
TrySendAsync 异步尝试发送数据。
(由 DmtpActorExtension 定义。)
TrySendAsync 异步尝试发送一个估计大小小于64K的IPackage
(由 DmtpActorExtension 定义。)
TrySendAsync 异步尝试发送数据包。 此方法通过指定的协议将数据包发送到客户端。 它使用估计的最大数据包大小来优化内存申请。
(由 DmtpActorExtension 定义。)
TrySubscribeChannel 尝试订阅已存在的通道。
(由 DmtpActorExtension 定义。)

参见