Open hanfengyangzai opened 1 year ago
还有这种错误,可能是网络有点波动引起的,程序并未检测到连接断开
mqtt发送消息异常。连接状态:true, 异常信息: org.eclipse.paho.client.mqttv3.MqttException: 等待来自服务器的响应时超时 at org.eclipse.paho.client.mqttv3.internal.Token.waitForCompletion(Token.java:112) at org.eclipse.paho.client.mqttv3.MqttToken.waitForCompletion(MqttToken.java:67) at org.eclipse.paho.client.mqttv3.MqttClient.publish(MqttClient.java:570)
使用这个类发送P2P消息通信 MQTTSendP2PMessage.class 重现步骤 1.启动MQTTSendP2PMessage连接mqtt 2.启动设备A 3.MQTTSendP2PMessage正常与设备A通信 4.断开MQTTSendP2PMessage服务所在电脑网络 5.隔5秒后重新接通网络 6.即打印如下错误,只能重启MQTTSendP2PMessage服务才能正常通信 org.eclipse.paho.client.mqttv3.MqttException: 客户机未连接 at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31) at org.eclipse.paho.client.mqttv3.internal.ClientComms.sendNoWait(ClientComms.java:205) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.publish(MqttAsyncClient.java:1375) at org.eclipse.paho.client.mqttv3.MqttClient.publish(MqttClient.java:570)