You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please fill out the form below before submitting, thank you!
Bug exists Release Version 1.2.5 ( Master Branch)
Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
public class Test {
public static void main(String[] args) throws IOException, MqttException {
MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
mqttConnectOptions.setUserName("test");
mqttConnectOptions.setPassword("test".toCharArray());
mqttConnectOptions.setCleanSession(true);
mqttConnectOptions.setKeepAliveInterval(30);
mqttConnectOptions.setConnectionTimeout(2);
MqttAsyncClient mq = new MqttAsyncClient("tcp://127.0.0.1:61611","test", new MemoryPersistence());
try {
IMqttToken token = mq.connect(mqttConnectOptions);
Thread.sleep(5000);
System.out.println(token.isComplete());
} catch (Exception e) {
e.printStackTrace();
}
}
}
The above example is a code that makes a connect request to any server without a message broker.
If you follow the code inside the library(package org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule(line:67 start())
public void start() throws IOException, MqttException {
final String methodName = "start";
try {
// @TRACE 252=connect to host {0} port {1} timeout {2}
log.fine(CLASS_NAME,methodName, "252", new Object[] {host, Integer.valueOf(port), Long.valueOf(conTimeout*1000)});
SocketAddress sockaddr = new InetSocketAddress(host, port);
socket = factory.createSocket();
socket.connect(sockaddr, conTimeout*1000);
socket.setSoTimeout(1000);
}
catch (ConnectException ex) {
//@TRACE 250=Failed to create TCP socket
log.fine(CLASS_NAME,methodName,"250",null,ex);
throw new MqttException(MqttException.REASON_CODE_SERVER_CONNECT_ERROR, ex);
}
}
you will call Socket connect.
Socket connect() for non-operating servers will cause ConnectException.
On the code, the generated ConnectException is thrown as MqttException.
But I can't get any reception, the project I made doesn't work normally.
Am I misunderstanding and using it?
The text was updated successfully, but these errors were encountered:
Please fill out the form below before submitting, thank you!
The above example is a code that makes a connect request to any server without a message broker.
If you follow the code inside the library(package org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule(line:67 start())
you will call Socket connect.
Socket connect() for non-operating servers will cause ConnectException.
On the code, the generated ConnectException is thrown as MqttException.
But I can't get any reception, the project I made doesn't work normally.
Am I misunderstanding and using it?
The text was updated successfully, but these errors were encountered: