M2MQTT throwing communicationException on mqttclint.connet

21 views Asked by At

Below is my code snippet to coonect to MQTT with SSL certificates

X509Certificate caCert = X509Certificate.CreateFromCertFile(Path.Combine("D:\Certificates", "cacert.pem"));
X509Certificate2 clientCert = new X509Certificate2(Path.Combine("D:\Certificates", "molexClient.pfx"), "molex");
MqttClient client = new MqttClient(address, MQTTPort, secure: false, caCert, clientCert, MqttSslProtocols.TLSv1_2);
client.ProtocolVersion = MqttProtocolVersion.Version_3_1;
client.Connect(Guid.NewGuid().ToString(),UserName, Password);

on line client.connect(), I am getting below exception.

uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException: 'Exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' was thrown.'

screenhot of M2MQTTCommunicationException

I have disabled firewalls and validate certificates as well. Still getting same exception. Also tried connect method only with clientId without username and password still getting same issue. Tried different browser.

0

There are 0 answers