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

TouchSocketConfig 类

配置文件基类

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
public class TouchSocketConfig : DependencyObject, 
	ICloneable
Inheritance
Object    DisposableObject    DependencyObject    TouchSocketConfig
Implements
ICloneable

构造函数

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

属性

DisposedValue 标识该对象是否已被释放
(继承自 DisposableObject。)

方法

Clone 克隆配置依赖项,并返回一个新的克隆对象。
CloneTo 将当前对象的依赖项克隆到目标对象中
(继承自 DependencyObject。)
Dispose 释放资源。内部已经处理了SuppressFinalize(Object)
(继承自 DisposableObject。)
Dispose(Boolean) 处置资源
(继承自 DependencyObject。)
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。)
MemberwiseCloneCreates a shallow copy of the current Object.
(继承自 Object。)
RemoveValueTValue 移除属性值。
(继承自 DependencyObject。)
SetValueTValue 设置依赖注入的值,如果值已经存在,将被覆盖。
(继承自 DependencyObject。)
ThrowIfDisposed 判断当前对象是否已经被释放。 如果已经被释放,则抛出ObjectDisposedException异常。
(继承自 DisposableObject。)
ToStringReturns a string that represents the current object.
(继承自 Object。)
TryGetValueTValue 尝试获取依赖注入的值,当没有注入时,会返回
(继承自 DependencyObject。)
TryRemoveValueTValue 尝试重置属性值,如果没有这个值,则返回
(继承自 DependencyObject。)

扩展方法

BuildClientAsyncTClient 构建可配置,可连接类客户端,并连接
(由 TouchSocketConfigExtension 定义。)
BuildServiceAsyncTService 构建Tcp类服务器,并启动。
(由 TouchSocketConfigExtension 定义。)
ConfigureContainer 配置容器注入。
(由 TouchSocketCoreConfigExtension 定义。)
ConfigurePlugins 配置插件。
(由 TouchSocketCoreConfigExtension 定义。)
Map
(由 Mapper 定义。)
Map
(由 Mapper 定义。)
MapTTarget
(由 Mapper 定义。)
SetAdapterOption 设置适配器相关的配置
(由 DataHandlingAdapterExtension 定义。)
SetBacklog 挂起连接队列的最大长度,默认不设置值。
(由 TouchSocketConfigExtension 定义。)
SetBindIPHost 固定端口绑定。

UdpSessionBase中表示本地监听地址

TcpClientBase中表示固定客户端端口号。


(由 TouchSocketConfigExtension 定义。)
SetClientSslOption 设置客户端Ssl配置,为Null时则不启用。
(由 TouchSocketConfigExtension 定义。)
SetDmtpOption 设置Dmtp相关配置。
(由 DmtpConfigExtension 定义。)
SetGetDefaultNewId 设置Tcp服务器默认Id的获取方式。仅服务器生效。
(由 TouchSocketConfigExtension 定义。)
SetHttpProxy 设置Http代理
(由 HttpConfigExtensions 定义。)
SetKeepAliveValue 在Socket的KeepAlive属性。

注意:这个是操作tcp底层的,如果你对底层不了解,建议不要动。


(由 TouchSocketConfigExtension 定义。)
SetListenIPHosts 服务器负责监听的地址组。
(由 TouchSocketConfigExtension 定义。)
SetListenOptions 直接单个配置服务器监听的地址组。
(由 TouchSocketConfigExtension 定义。)
SetMaxBufferSize 最大缓存容量,默认缺省。

    (由 TouchSocketConfigExtension 定义。)
SetMaxCount 最大可连接数,默认为10000。
(由 TouchSocketConfigExtension 定义。)
SetMinBufferSize 最小缓存容量,默认缺省。

    (由 TouchSocketConfigExtension 定义。)
SetNamedPipeDataHandlingAdapter 设置(命名管道系)数据处理适配器。
(由 NamedPipeConfigExtension 定义。)
SetNamedPipeListenOptions 直接单个配置命名管道监听的地址组。
(由 NamedPipeConfigExtension 定义。)
SetNoDelay 设置Socket的NoDelay属性,默认不做处理。
(由 TouchSocketConfigExtension 定义。)
SetPipeName 当管道在本机时,仅设置管道名称即可。
(由 NamedPipeConfigExtension 定义。)
SetPipeServer 设置命名管道的主机名称。
(由 NamedPipeConfigExtension 定义。)
SetRegistrator 设置IRegistrator
(由 TouchSocketCoreConfigExtension 定义。)
SetRemoteIPHost 设置远程目标地址。在UdpSessionBase中,表示默认发送时的目标地址。
(由 TouchSocketConfigExtension 定义。)
SetResolver 设置IResolver
(由 TouchSocketCoreConfigExtension 定义。)
SetSendTimeout 发送超时设定,单位毫秒,默认为0。意为禁用该配置。
(由 TouchSocketConfigExtension 定义。)
SetSerialDataHandlingAdapter 设置(串口系)数据处理适配器。
(由 SerialPortConfigExtension 定义。)
SetSerialPortOption 设置串口属性。
(由 SerialPortConfigExtension 定义。)
SetServerName 服务名称,用于标识,无实际意义
(由 TouchSocketConfigExtension 定义。)
SetServiceSslOption 设置客户端Ssl配置,为Null时则不启用。
(由 TouchSocketConfigExtension 定义。)
SetTcpDataHandlingAdapter 设置(Tcp系)数据处理适配器。
(由 TouchSocketConfigExtension 定义。)
SetThreadCount 多线程数量,默认为-1缺省,实际上在udp中相当于1。

UDP模式中,该值为重叠IO并发数


(由 TouchSocketConfigExtension 定义。)
SetUdpDataHandlingAdapter 设置(Udp系)数据处理适配器。
(由 TouchSocketConfigExtension 定义。)
SetWebSocketOption 设置WebSocket的相关配置
(由 WebSocketConfigExtension 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)
UseAspNetCoreContainer 使用AspNetCoreContainer作为容器。
(由 AspNetCoreConfigExtension 定义。)
UseAutofacContainer 使用AutofacContainer作为容器。
(由 AutofacConfigExtension 定义。)
UseAutofacContainer 使用AutofacContainer作为容器。

注意:使用此方法,在构建组件时,内部会自行调用Build(ContainerBuildOptions).


(由 AutofacConfigExtension 定义。)
UseAutofacContainer 使用AutofacContainer作为容器。

注意:使用此方法,在构建组件时,内部会直接使用解决器,不再调用Build(ContainerBuildOptions).


(由 AutofacConfigExtension 定义。)
UseBroadcast 该值指定 System.Net.Sockets.Socket可以发送或接收广播数据包。
(由 TouchSocketConfigExtension 定义。)
UseReuseAddress 启用端口复用。

该配置可在服务器、或客户端在监听端口时,运行监听同一个端口。可以一定程度缓解端口来不及释放的问题


(由 TouchSocketConfigExtension 定义。)
UseUdpConnReset 解决Windows下UDP连接被重置错误10054。
(由 TouchSocketConfigExtension 定义。)
UseUdpReceive 当udp作为客户端时,开始接收数据。起作用相当于SetBindIPHost(TouchSocketConfig, IPHost)随机端口。
(由 TouchSocketConfigExtension 定义。)

显式接口实现

ICloneableCloneCreates a new object that is a copy of the current instance.

参见