点击或拖拽改变大小

MqttSyncClientReadString 方法

从MQTT服务器同步读取数据,将指定编码的字符串payload发送到服务器,然后从服务器返回相关的数据,并转换为指定编码的字符串,支持数据发送进度报告,服务器执行进度报告,接收数据进度报告操作
Synchronously read data from the MQTT server, send the specified encoded string payload to the server, and then return the data from the server, and convert it to the specified encoded string, support data transmission progress report, the server executes the progress report, and receives the data progress report

命名空间:  HslCommunication.MQTT
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public OperateResult<string, string> ReadString(
	string topic,
	string payload,
	Action<long, long> sendProgress = null,
	Action<string, string> handleProgress = null,
	Action<long, long> receiveProgress = null
)

参数

topic
类型:SystemString
主题信息
payload
类型:SystemString
负载数据
sendProgress (Optional)
类型:SystemActionInt64, Int64
发送数据给服务器时的进度报告,第一个参数为已发送数据,第二个参数为总发送数据
handleProgress (Optional)
类型:SystemActionString, String
服务器处理数据的进度报告,第一个参数Topic自定义,通常用来传送操作百分比,第二个参数自定义,通常用来表示服务器消息
receiveProgress (Optional)
类型:SystemActionInt64, Int64
从服务器接收数据的进度报告,第一个参数为已接收数据,第二个参数为总接收数据

返回值

类型:OperateResultString, String
服务器返回的数据信息
参见