Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] Connect behavior

Hi,

I use successfully the mosquito library (version 1.6) in my application with the threaded model.

Everything works fine, except one strange behavior of the library. Sometimes, when the client connects to the broker, there is a first TCP SYN sequence sent by the library but without the CONNECT request. Then, after the timeout, this first TCP socket is closed by the library and a second TCP SYN is sent. In this second socket, the CONNECT request is correctly sent and everything works fine.

I use the following mosquito API to set up the connection, no TLS, no username/password.

mosquitto_lib_init()
mosquitto_new()
mosquitto_loop_start()
mosquito_connect_async()

Here is a copy of TcpDump showing this unexpected behavior.

No.     Time           Source                Destination           Protocol Length Info
      1 0.000000       192.168.42.3          188.118.5.138         TCP      74     53834 → 1883 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=5953010 TSecr=0 WS=8
      2 0.019312       188.118.5.138         192.168.42.3          TCP      74     1883 → 53834 [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=1452 WS=256 SACK_PERM=1 TSval=3637253104 TSecr=5953010
      3 0.021792       192.168.42.3          188.118.5.138         TCP      66     53834 → 1883 [ACK] Seq=1 Ack=1 Win=29200 Len=0 TSval=5953036 TSecr=3637253104
      4 0.997223       192.168.42.3          188.118.5.138         TCP      66     53834 → 1883 [FIN, ACK] Seq=1 Ack=1 Win=29200 Len=0 TSval=5954012 TSecr=3637253104
      5 1.000619       192.168.42.3          188.118.5.138         TCP      74     53836 → 1883 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=5954015 TSecr=0 WS=8
      6 1.015894       188.118.5.138         192.168.42.3          TCP      66     1883 → 53834 [ACK] Seq=1 Ack=2 Win=66048 Len=0 TSval=3637253204 TSecr=5954012
      7 1.019364       188.118.5.138         192.168.42.3          TCP      66     1883 → 53834 [FIN, ACK] Seq=1 Ack=2 Win=66048 Len=0 TSval=3637253204 TSecr=5954012
      8 1.021805       192.168.42.3          188.118.5.138         TCP      66     53834 → 1883 [ACK] Seq=2 Ack=2 Win=29200 Len=0 TSval=5954036 TSecr=3637253204
      9 1.026273       188.118.5.138         192.168.42.3          TCP      74     1883 → 53836 [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=1452 WS=256 SACK_PERM=1 TSval=3637253204 TSecr=5954015
     10 1.028782       192.168.42.3          188.118.5.138         TCP      66     53836 → 1883 [ACK] Seq=1 Ack=1 Win=29200 Len=0 TSval=5954043 TSecr=3637253204
     11 1.031684       192.168.42.3          188.118.5.138         MQTT     101    Connect Command
     12 1.050238       188.118.5.138         192.168.42.3          MQTT     70     Connect Ack
     13 1.052704       192.168.42.3          188.118.5.138         TCP      66     53836 → 1883 [ACK] Seq=36 Ack=5 Win=29200 Len=0 TSval=5954067 TSecr=3637253207

Is this something known?

Regards,

Philippe


Back to the top