LabVIEW-Open-Source / MQTT-Client

A LabVIEW-based client for MQTT
Other
27 stars 4 forks source link

Error code 66 with SSL #25

Open stefranco1983 opened 3 weeks ago

stefranco1983 commented 3 weeks ago

Hi, sorry for my trivial question. I downloaded this library and it seems very interesting. I need to connect with a server that uses the SSL protocol (hivemq.cloud). No certificate is currently required on the server. To log in I only use my username and password. When I start the program, "Connection accepted" appears but there is error 66. The software hangs on "Connect to Server.vi".

Could you help me?

PS: Setting url and credentials to an old TCP server (cloudmqtt.com) works fine.

Thanks for the support.

photolabview

francois-normandin commented 3 weeks ago

@stefranco1983 Error 66 means that the server is disconnecting the socket (closed by peer), so it`s telling you that there is a problem with one of these:

At first glance, I believe you need to set the hostname to the "server hostname", and you need to provide the client with the server X.509 certificate (provided by hivemq, probably found in your account somewhere). The hostname is the hostname that was used to sign the certificate, so if it does not match, you will not get to connect.

Using the test server, I get the same error 66 until I add a certificate... but since I don`t have an account, I do not have a valid certificate for this server, and it gets rejected with error -715050: Remote Host Identification has Failed. That suggests that all you need is to find your server certificate and pass it in with the correct hostname.

image

If you do not provide a certificate (Ready for SSL = False), then it tries a non-TLS connection. That might work for port 1883, but not port 8883...

This is where the connection happens: image

francois-normandin commented 3 weeks ago

https://community.hivemq.com/t/frequently-asked-questions-hivemq-cloud/514

stefranco1983 commented 3 weeks ago

Thanks for the quick replies! I did as you suggested. I put the same address on both "hostname" and "address". Then I followed the link you gave me (hivemq FAQ) and downloaded the .pem file (certificate).

Now "Ready for SSL" appear and I have sent the first topic!

immagine

The first step is done!

I hope not to disturb you during the next steps!

Thank you!

francois-normandin commented 3 weeks ago

Glad to hear that!

May I suggest that you always disconnect and destroy the connection... That will reduce the risk of running out of sockets, memory leaks and other issues of the sort.


From: stefranco1983 @.> Sent: Tuesday, June 11, 2024 10:15:10 AM To: LabVIEW-Open-Source/MQTT-Client @.> Cc: Francois Normandin @.>; Comment @.> Subject: Re: [LabVIEW-Open-Source/MQTT-Client] Error code 66 with SSL (Issue #25)

Thanks for the quick replies! I did as you suggested. I put the same address on both "hostname" and "address". Then I followed the link you gave me (hivemq FAQ) and downloaded the .pem file (certificate).

Now "Ready for SSL" appear and I have sent the first topic!

immagine.png (view on web)https://github.com/LabVIEW-Open-Source/MQTT-Client/assets/172271322/f4915b15-52b1-43ea-b899-28d514d91013

The first step is done!

I hope not to disturb you during the next steps!

Thank you!

— Reply to this email directly, view it on GitHubhttps://github.com/LabVIEW-Open-Source/MQTT-Client/issues/25#issuecomment-2161252160, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACZPNJC7AM77YN6S67RF3TDZG4WB5AVCNFSM6AAAAABJEFLTISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRRGI2TEMJWGA. You are receiving this because you commented.Message ID: @.***>

stefranco1983 commented 2 weeks ago

I'll follow your suggestion, thank you!