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

ModbusUdpSlave 类

基于Udp协议的Modbus从站

Definition

命名空间: TouchSocket.Modbus
程序集: TouchSocketPro.Modbus (在 TouchSocketPro.Modbus.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
public class ModbusUdpSlave : UdpSessionBase, 
	IModbusUdpSlave, IUdpSessionBase, IServiceBase, ISetupConfigObject, IResolverConfigObject, 
	IConfigObject, IDependencyObject, IDisposableObject, IDisposable, ILoggerObject, 
	IPluginObject, IResolverObject, IClient, IModbusSlave
Inheritance
Object    DisposableObject    DependencyObject    ConfigObject    ResolverConfigObject    SetupConfigObject    ServiceBase    UdpSessionBase    ModbusUdpSlave
Implements
IDisposable, IConfigObject, IDependencyObject, IDisposableObject, ILoggerObject, IPluginObject, IResolverConfigObject, IResolverObject, ISetupConfigObject, IModbusSlave, IModbusUdpSlave, IClient, IServiceBase, IUdpSessionBase

构造函数

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

属性

Config 配置项
(继承自 SetupConfigObject。)
DisposedValue 标识该对象是否已被释放
(继承自 DisposableObject。)
IsClient 在Udp中,该值没有意义,且可以自由赋值。
(继承自 UdpSessionBase。)
LastReceivedTime 最后一次接收到数据的时间
(继承自 UdpSessionBase。)
LastSentTime 最后一次发送数据的时间
(继承自 UdpSessionBase。)
Logger 日志记录器
(继承自 ConfigObject。)
ModbusDataLocater 
Monitor
(继承自 UdpSessionBase。)
PluginManager 插件管理器
(继承自 SetupConfigObject。)
ProtectedDataHandlingAdapter 数据处理适配器
(继承自 UdpSessionBase。)
Protocol 终端协议
(继承自 UdpSessionBase。)
RemoteIPHost
(继承自 UdpSessionBase。)
Resolver 获取解析器实例。
(继承自 SetupConfigObject。)
ServerName 服务器名称
(继承自 ServiceBase。)
ServerState 服务器状态
(继承自 UdpSessionBase。)

方法

CloneTo 将当前对象的依赖项克隆到目标对象中
(继承自 DependencyObject。)
Dispose 释放资源。内部已经处理了SuppressFinalize(Object)
(继承自 DisposableObject。)
Dispose(Boolean) 处置资源
(继承自 UdpSessionBase。)
DropMulticastGroup 从组播组中退出。
(继承自 UdpSessionBase。)
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。)
JoinMulticastGroup 加入组播。

组播地址为 224.0.0.0 ~ 239.255.255.255,其中 224.0.0.0~224.255.255.255 不建议在用户程序中使用,因为它们一般都有特殊用途。


(继承自 UdpSessionBase。)
LoadConfig 加载配置
(重写 UdpSessionBaseLoadConfig(TouchSocketConfig))
MemberwiseCloneCreates a shallow copy of the current Object.
(继承自 Object。)
OnUdpReceived 处理已接收到的数据。
(继承自 UdpSessionBase。)
OnUdpSending 在UDP数据即将发送时触发插件。 如果当前类覆盖了父类的方法,则不会触发插件。
(继承自 UdpSessionBase。)
PreviewBind 在Socket初始化对象后,Bind之前调用。 可用于设置Socket参数。 父类方法可覆盖。
(继承自 UdpSessionBase。)
ProtectedClearReceiver 清除当前的UDP接收器对象。
(继承自 UdpSessionBase。)
ProtectedCreateReceiver 创建或获取一个UDP接收器对象。
(继承自 UdpSessionBase。)
ProtectedDefaultSendAsync(ReadOnlyMemoryByte) 异步发送只读字节内存到远程主机。 此方法提供了一种默认的发送方式,确保只有在可以发送且远程IP主机不为空时才尝试发送数据。
(继承自 UdpSessionBase。)
ProtectedDefaultSendAsync(EndPoint, ReadOnlyMemoryByte) 异步发送数据到指定的端点。 此方法用于封装实际的数据发送逻辑,在发送之前会进行必要的检查和调用事件处理程序,以确保数据的正确发送。
(继承自 UdpSessionBase。)
ProtectedSendAsync(IListArraySegmentByte) 异步安全发送数据方法。 本方法提供了一种安全的异步数据发送方式,确保在发送过程中, 使用了端点信息并且避免了潜在的空引用错误。
(继承自 UdpSessionBase。)
ProtectedSendAsync(IRequestInfo) 异步发送数据,使用提供的请求信息。
(继承自 UdpSessionBase。)
ProtectedSendAsync(ReadOnlyMemoryByte) 异步发送数据,使用提供的内存数据。
(继承自 UdpSessionBase。)
ProtectedSendAsync(EndPoint, IListArraySegmentByte) 异步发送数据到指定的端点。
(继承自 UdpSessionBase。)
ProtectedSendAsync(EndPoint, ReadOnlyMemoryByte) 异步发送数据到指定的端点。 该方法通过适配器转发数据,如果适配器未设置,则采用默认发送方式。
(继承自 UdpSessionBase。)
ProtectedSendAsync(EndPoint, IRequestInfo) 异步发送请求信息到指定的端点。 在发送之前,会检查是否具备发送请求信息的能力,并通过适配器进行发送。
(继承自 UdpSessionBase。)
ReceivingData 当收到原始数据时,处理数据。 该方法提供了一个机制,通过该机制可以对原始数据进行自定义处理,而不必修改具体的传输逻辑。
(继承自 UdpSessionBase。)
RemoveValueTValue 移除属性值。
(继承自 DependencyObject。)
SetAdapter 设置适配器
(继承自 UdpSessionBase。)
SetupAsync 异步配置设置项
(继承自 SetupConfigObject。)
SetValueTValue 设置依赖注入的值,如果值已经存在,将被覆盖。
(继承自 DependencyObject。)
StartAsync 异步启动
(继承自 UdpSessionBase。)
StopAsync 异步停止
(继承自 UdpSessionBase。)
ThrowIfConfigIsNull 如果Config为空,则抛出ArgumentNullException的异常。
(继承自 ConfigObject。)
ThrowIfDisposed 判断当前对象是否已经被释放。 如果已经被释放,则抛出ObjectDisposedException异常。
(继承自 DisposableObject。)
ToStringReturns a string that represents the current object.
(继承自 Object。)
TryGetValueTValue 尝试获取依赖注入的值,当没有注入时,会返回
(继承自 DependencyObject。)
TryRemoveValueTValue 尝试重置属性值,如果没有这个值,则返回
(继承自 DependencyObject。)

扩展方法

GetSlavePointBySlaveId 通过站号获取实际站点。
(由 ModbusSlaveExtension 定义。)
Map
(由 Mapper 定义。)
Map
(由 Mapper 定义。)
MapTTarget
(由 Mapper 定义。)
SafeDispose 安全性释放(不用判断对象是否为空)。不会抛出任何异常。

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


(由 SystemExtension 定义。)
SafeDispose 安全性释放(不用判断对象是否为空)。不会抛出任何异常。
(由 SystemExtension 定义。)
Setup 同步配置方法。 使用给定的配置对象进行设置。
(由 SetupConfigObjectExtension 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

参见