gpt4 book ai didi

java - 无权连接 (5)

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:38:42 27 4
gpt4 key购买 nike

一台机器已经连接到 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 协议(protocol)要求每个客户端连接使用唯一的 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

关于java - 无权连接 (5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37157079/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com