question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MqttCommunicationException after client connect

See original GitHub issue

Hello,

I am using this library and have tried both v2.4 (nuget and master branch). On my laptop, it works when its connected to WiFi (internet) and ethernet cable (IP camera).

When I test it without WiFi and only IP camera connected via ethernet, MQTT client connects and disconnects immediately with following exception:

2017-11-06 16:54:46.2571 | DEBUG | ### CONNECTED TO SERVER ### 
2017-11-06 16:54:46.2571 | DEBUG | ### DISCONNECTED FROM SERVER ### 
2017-11-06 16:54:46.3551 | ERROR | mqttClient.Connected 
EXCEPTION: MQTTnet.Core.Exceptions.MqttCommunicationException: The client is not connected.
   at MQTTnet.Core.Client.MqttClient.ThrowIfNotConnected()
   at MQTTnet.Core.Client.MqttClient.<SubscribeAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at UVSS_App.FormUVSS.<<-ctor>b__31_0>d.MoveNext() in D:\Projects

The system where the app is going to be deployed only have ethernet connection without internet. Same issue, connection is established but disconnected immediately.

I have enabled anonymous login on mosquitto service running on same laptop (localhost), but it still does the same thing. I am not binding mqtt server to any IP, it works only on my laptop with I have both WiFi and ethernet cable connected.

What could be the reason for such behavior? any pointers?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
chkr1011commented, Nov 17, 2017

This issue is fixed in the preview version 2.5.2-rc1 (available as nuget). Please let me know if the issue is now fixed.

0reactions
chall3ng3rcommented, Nov 24, 2017

Using the latest version from nuget, and issue seems to be fixed 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

MqttCommunicationException after client connect · Issue #91
On my laptop, it works when its connected to WiFi (internet) and ethernet cable (IP camera). When I test it without WiFi and...
Read more >
Resolving problem: MQTT client does not connect
The MQ Telemetry Java client only hangs if the application has set an indefinite timeout. The client throws one of these exceptions after...
Read more >
Android client cannot connect to C# MQTT Server, error ...
ConnectException: Connection refused exception means that there is no service listening on the host and port you are trying to connect to, ...
Read more >
Resolving problem: MQTT client does not connect
The client throws one of these exceptions after the timeout set for MqttClient. Connect expires with an undiagnosed connection problem. Unless ...
Read more >
Not able to connect with broker using MQTTNet library .net ...
So, I tested hivemq broker with mqtt.fx and works. Only in the code the return is connected = false. Any ideas? the error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found