MQTTnet: MQTTnet.Exceptions.MqttProtocolViolationException: Received packet 'PubAck: [PacketIdentifier=21584] [ReasonCode=]' at an unexpected time.

Describe the bug

A clear and concise description of what the bug is.

Which project is your bug related to?

  • [ √] ManagedClient

To Reproduce

An error occurred while connecting to the mqtt service。 This problem exists with the latest version or 2.8.5 Using TCP This error occurs when the program is running on Windows 7 sp1, but it is normal in Windows 10.

Additional context / logging

MQTTnet.Exceptions.MqttProtocolViolationException: Received packet ‘PubAck: [PacketIdentifier=21584] [ReasonCode=]’ at an unexpected time.

Code example

var options = new ManagedMqttClientOptionsBuilder()
		.WithAutoReconnectDelay(TimeSpan.FromSeconds(5))
		.WithClientOptions(new MqttClientOptionsBuilder()
			.WithClientId(Guid.NewGuid().ToString())                            
			.WithTcpServer("127.0.0.1", 33382)
			.WithCredentials(brokerInfo.BrokerUser, brokerInfo.BrokerPassword)
			.WithCleanSession()
			.Build())
		.Build();
var mqttClient = new MqttFactory().CreateManagedMqttClient();
mqttClient.StartAsync(options);               
mqttClient.ConnectingFailedHandler = new FailedHandler();                
mqttClient.ConnectedHandler = new ConnectedHandler(lblWsState);

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16

Most upvoted comments