我想问mqtt套接字错误。
我有ubuntu服务器。我使用了mosquitto服务。
所以我连接Android客户端。我使用了paho 1.0.3 lib
但有时连接丢失重复。
服务器日志
1454388230: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181519283686687 (c1, k5).
1454388236: Client IM-A910S9fdeedcc8ef15c26paho181519283686687 has exceeded timeout, disconnecting.
1454388236: Socket error on client IM-A910S9fdeedcc8ef15c26paho181519283686687, disconnecting.
1454388236: New connection from 000.000.000.000 on port 1883.
1454388236: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181522670926999 (c1, k5).
1454388243: Client IM-A910S9fdeedcc8ef15c26paho181522670926999 has exceeded timeout, disconnecting.
1454388243: Socket error on client IM-A910S9fdeedcc8ef15c26paho181522670926999, disconnecting.
1454388243: New connection from 000.000.000.000 on port 1883.
1454388243: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181525239226685 (c1, k5).
1454388244: Client IM-A910S9fdeedcc8ef15c26paho181525239226685 disconnected.
1454388245: New connection from 000.000.000.000 on port 1883.
1454388245: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181527274326928 (c1, k5).
1454388252: Client IM-A910S9fdeedcc8ef15c26paho181527274326928 has exceeded timeout, disconnecting.
1454388252: Socket error on client IM-A910S9fdeedcc8ef15c26paho181527274326928, disconnecting.
1454388261: New connection from 000.000.000.000 on port 1883.
1454388261: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181534506521167 (c1, k5).
1454388267: Client IM-A910S9fdeedcc8ef15c26paho181534506521167 has exceeded timeout, disconnecting.
1454388267: Socket error on client IM-A910S9fdeedcc8ef15c26paho181534506521167, disconnecting.
1454388267: New connection from 000.000.000.000 on port 1883.
1454388267: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181537844139396 (c1, k5).
1454388274: Client IM-A910S9fdeedcc8ef15c26paho181537844139396 has exceeded timeout, disconnecting.
1454388274: Socket error on client IM-A910S9fdeedcc8ef15c26paho181537844139396, disconnecting.
1454388274: New connection from 000.000.000.000 on port 1883.
1454388274: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181540325027833 (c1, k5).
1454388275: Client IM-A910S9fdeedcc8ef15c26paho181540325027833 disconnected.
1454388286: New connection from 000.000.000.000 on port 1883.
1454388286: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181543990640541 (c1, k5).
1454388293: Client IM-A910S9fdeedcc8ef15c26paho181543990640541 has exceeded timeout, disconnecting.
1454388293: Socket error on client IM-A910S9fdeedcc8ef15c26paho181543990640541, disconnecting.
1454388293: New connection from 000.000.000.000 on port 1883.
1454388293: New client connected from 000.000.000.000 as IM-A910S9fdeedcc8ef15c26paho181548653565128 (c1, k5).
Android错误
W/System.err: connection lost (32109) - java.io.EOFException
W/System.err: at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146)
W/System.err: at java.lang.Thread.run(Thread.java:841)
W/System.err: Caused by: java.io.EOFException
W/System.err: at java.io.DataInputStream.readByte(DataInputStream.java:77)
W/System.err: at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65)
W/System.err: at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107)
答案 0 :(得分:0)
尝试将ClientID更改为静态值,例如clientId =“exampleTest”+“ - sub”;它适用于我,但我仍在搜索为什么它会发生两次注册clientID或将其保存在某个文件中