mqtt Client hat die gleiche Client ID wie zum Schließen der alten Verbindung? einfach so.Mqtt Broker, alte Verbindung schließen
New connection from 192.168.3.57 on port 1883.
1479826181: Client paho166768969170988 already connected, closing old connection.
1479826181: Client paho166768969170988 disconnected.
1479826181: New client connected from 192.168.3.57 as paho166768969170988 (c1, k60, u'admin').
EDIT:
String clientId ="**public_cloud**";
try {
MqttClient sampleClient = new MqttClient(config.getBroker(), clientId);
sampleClient.setCallback(new PushCallback());
MqttTopic mtopic = sampleClient.getTopic(config.getTopic());
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(true);
connOpts.setConnectionTimeout(100);
connOpts.setKeepAliveInterval(200);
connOpts.setUserName(config.getUsername());
connOpts.setPassword(config.getPassword().toCharArray());
connOpts.setWill(mtopic, "close".getBytes(), 0, true);
sampleClient.connect(connOpts);
} catch (MqttException e) {
e.printStackTrace();
}
}
wenn die clientid gleich ist, hat Fehler.
ConnectionLost, Ursache: (32109) - java.io.EOFException
Bitte erläutern eindeutig zu verwenden, was sich hier fragen. – hardillb