0

I want ask mqtt socket error.

I have ubuntu server. and I used mosquitto service.

so I connect Android Client. I used paho 1.0.3 lib

but sometime connection lost repeat.

server log is

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).

And Android error is

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)
Cœur
  • 37,241
  • 25
  • 195
  • 267
박준걸
  • 1
  • 1

1 Answers1

0

Try to the change the ClientID to static value for example clientId ="exampleTest" + "-sub"; it works with me but i am still searching why it does happen to register the clientID two times or keep it in some file

  • The clientIDs in this case are the ones automatically generated by the Paho Client and are different each time. Setting them to a fixed value will not help and definitely will not work with multiple clients as clientIDs have to be unique across all clients. – hardillb Aug 28 '18 at 06:55