编程语言
首页 > 编程语言> > java-未经授权可连接(5)

java-未经授权可连接(5)

作者:互联网

一台计算机已连接到solace,并且我希望另一台计算机已连接,但是它警告异常,如下所示:

org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:28)

org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:885)

org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:118)
java.lang.Thread.run(Unknown Source)

如果我断开一台计算机的连接,则另一台计算机可以连接.默认情况下是否只能连接一台计算机?如果是这样,如何设置它,以便许多机器都可以连接.

解决方法:

您的应用程序的两个实例都可能尝试使用相同的clientId进行连接.
MQTT协议要求每个客户端连接使用唯一的clientId.

3.1.3.1 Client Identifier

The Client Identifier (ClientId) identifies the Client to the Server. Each Client connecting to the Server has a unique ClientId. The ClientId MUST be used by Clients and by Servers to identify state that they hold relating to this MQTT Session between the Client and the Server [MQTT-3.1.3-2].

对于Solace系统实施,

  • ClientIds can be up to 128 bytes in length
  • ClientIds can contain any UTF-8 characters as allowed by Section 1.5.3

标签:paho,solace,java,mqtt
来源: https://codeday.me/bug/20191118/2029983.html