点击或拖拽改变大小

PipeSocket 类

基于网络通信的管道信息,可以设置额外的一些参数信息,例如连接超时时间,读取超时时间等等。
Based on the pipe information of network communication, some additional parameter information can be set, such as connection timeout time, read timeout time and so on.
继承层次
SystemObject
  HslCommunication.Core.PipePipeBase
    HslCommunication.Core.PipePipeSocket

命名空间:  HslCommunication.Core.Pipe
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public class PipeSocket : PipeBase, IDisposable

PipeSocket 类型公开以下成员。

构造函数
  名称说明
公共方法PipeSocket
实例化一个默认的对象
Instantiate a default object
公共方法PipeSocket(String, Int32)
通过指定的IP地址和端口号来实例化一个对象
Instantiate an object with the specified IP address and port number
Top
属性
  名称说明
公共属性代码示例ConnectTimeOut
获取或设置接收服务器反馈的时间,如果为负数,则不接收反馈
Gets or sets the time to receive server feedback, and if it is a negative number, does not receive feedback
公共属性代码示例IpAddress
获取或是设置远程服务器的IP地址,如果是本机测试,那么需要设置为127.0.0.1
Get or set the IP address of the remote server. If it is a local test, then it needs to be set to 127.0.0.1
公共属性IsSocketError
指示长连接的套接字是否处于错误的状态
Indicates if the long-connected socket is in the wrong state
公共属性LocalBinding
获取或设置绑定的本地的IP地址和端口号信息,如果端口设置为0,代表任何可用的端口
Get or set the bound local IP address and port number information, if the port is set to 0, it means any available port
公共属性LockingTick
获取当前进入等待锁的数量
Gets the number of pending locks currently entered
(继承自 PipeBase。)
公共属性代码示例Port
获取或设置服务器的端口号,具体的值需要取决于对方的配置
Gets or sets the port number of the server. The specific value depends on the configuration of the other party.
公共属性代码示例ReceiveTimeOut
获取或设置接收服务器反馈的时间,如果为负数,则不接收反馈
Gets or sets the time to receive server feedback, and if it is a negative number, does not receive feedback
公共属性SleepTime
获取或设置在正式接收对方返回数据前的时候,需要休息的时间,当设置为0的时候,不需要休息。
Get or set the time required to rest before officially receiving the data from the other party. When it is set to 0, no rest is required.
公共属性Socket
获取或设置当前的客户端用于服务器连接的套接字。
Gets or sets the socket currently used by the client for server connection.
Top
方法
  名称说明
公共方法ChangePorts
变更当前的端口号信息,如果设置了多个端口号的话,就切换其他可用的端口
Change the current port number information, and if multiple port numbers are set, switch to other available ports
公共方法Dispose
释放被 PipeSocket 使用的所有资源
(重写 PipeBaseDispose.)
公共方法Equals (继承自 Object。)
受保护的方法Finalize (继承自 Object。)
公共方法GetConnectIPEndPoint
获取当前的远程连接信息,如果端口号设置了可选的数组,那么每次获取对象就会发生端口号切换的操作。
Get the current remote connection information. If the port number is set to an optional array, the port number switching operation will occur every time the object is obtained.
公共方法GetHashCode (继承自 Object。)
公共方法GetType (继承自 Object。)
公共方法IsConnectitonError
获取当前的连接状态是否发生了异常,如果发生了异常,返回 False
Gets whether an exception has occurred in the current connection state, and returns False if an exception has occurred
受保护的方法MemberwiseClone (继承自 Object。)
公共方法PipeLockEnter
获取锁,可以指定获取锁的超时时间,如果指定的时间没有获取锁,则返回False,反之,返回True
To acquire a lock, you can specify the timeout period for acquiring a lock, return False if the specified time does not acquire a lock, and vice versa, return True
(继承自 PipeBase。)
公共方法PipeLockLeave
离开锁
Leave the lock
(继承自 PipeBase。)
公共方法SetMultiPorts
设置多个可选的端口号信息,例如在三菱的PLC里,支持配置多个端口号,当一个网络发生异常时,立即切换端口号连接读写,提升系统的稳定性
Set multiple optional port number information. For example, in Mitsubishi PLC, it supports to configure multiple port numbers. When an abnormality occurs in a network, the port number is immediately switched to connect to read and write to improve the stability of the system.
公共方法ToString (重写 ObjectToString.)
Top
扩展方法
  名称说明
公共扩展器方法ToJsonString
获取当前对象的JSON格式表示的字符串。
Gets the string represented by the JSON format of the current object.
(由 HslExtension 定义。)
Top
参见