最近由于自己使用到M2MQTT,在网上综合了一些教程后自己完善了一个封装类。
具体用法见代码
using System;
using System.Collections.Generic;using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using uPLibrary.Networking.M2Mqtt.Messages;
namespace uPLibrary.Networking.M2Mqtt
{
public class MqttClientService
{
private static volatile MqttClientService _instance = null;
private static readonly object LockHelper = new object();
/// <summary>
/// 创建单例模式
/// </summary>
/// <param name="ipAddress"></param>
/// <returns></returns>
publ