Hi Ian,
I ran the
client again with the environment variables set:
===
Subscriber message received: =====
topic :
TEST/holding_registers/Power
qos : 2
payload :
"0kW"
retain : 0
======================================
Trying to
connect
...=========================================================
Trace Output
Product name:
Paho Synchronous MQTT C Client Library
Version:
1..0.3
Build level:
Thu Feb 4 12:28:07 GMT 2016
OpenSSL
version: OpenSSL 1.0.1j 15 Oct 2014
OpenSSL
flags: compiler:
/home/jharte/bb-buildroot/buildroot-2014.11/output/host/usr/bin/arm-linux-gnueabihf-gcc
-fPIC -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS
-D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIO
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -pipe -Os -Wall
-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM
-DSHA256_ASM -DSHA512_ASM -DAES_ASM -DGHASH_ASM
OpenSSL build
timestamp: built on: Thu Feb 4 12:20:24 GMT 2016
OpenSSL
platform: platform: linux-armv4
OpenSSL
directory: OPENSSLDIR: "/etc/ssl"
/proc/version:
Linux version 3.12.10
(root@Ubuntu-1204-precise-64-minimal) (gcc version 4..9.2
20140904 (prerelease) (crosstool-NG
linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) ) #1
Thu Feb 4 12:31:30 GMT 2016
=========================================================
20160218
124235.710 8 20.27 -> CONNECT cleansession: 1 (0)
20160218
124235.721 8 20.27 <- CONNACK rc: 0
success!
20160218
124236.722 8 20.27 -> PUBLISH msgid: 1 qos: 2 retained:
0 (0) payload: "0kW"
20160218
124236..732 8 20.27 <- PUBREC msgid: 1
20160218
124236.733 8 20.27 -> PUBREL msgid: 1 (0)
20160218
124236.739 8 20.27 <- PUBCOMP msgid:1
Msg sent!
===
Subscriber message received: =====
topic :
TEST/holding_registers/Power
qos : 2
payload :
"1kW"
retain : 0
======================================
20160218
124434.559 8 20.27 -> PUBLISH msgid: 2 qos: 2 retained:
0 (0) payload: "1kW"
20160218
124434.560 8 20.27 -> PINGREQ (0)
20160218
124434.561 8 20.27 -> DISCONNECT (-1)
Msg sent!
It doesn’t
send a PINGREQ until a second message to publish appears,
at which point the broker has disconnected the client.
Hi Joe,
pings should occur by default. You can have the client
library display the MQTT packets it's sending and receiving
by setting the environment variables:
export MQTT_C_CLIENT_TRACE=ON
export MQTT_C_CLIENT_TRACE_LEVEL=PROTOCOL
and the output of the stdinpub sample program becomes:
[icraggs@oc0024870786 samples]$ LD_LIBRARY_PATH=..
./stdinpub x --host iot.eclipse.org
Using topic x
=========================================================
Trace Output
Product name: Paho Synchronous MQTT C Client Library
Version: 1.0.3
Build level: Thu Feb 18 12:12:13 GMT 2016
/proc/version: Linux version 2.6.32-573.14.1.el6.x86_64 (mockbuild@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
(gcc version 4.4.7 20120313 (Red Hat 4..4.7-16) (GCC) ) #1
SMP Thu Dec 17 14:49:33 EST 2015
=========================================================
Connecting
20160218 121354.779 3 publisher -> CONNECT cleansession:
1 (0)
20160218 121354.899 3 publisher <- CONNACK rc: 0
20160218 121405.902 3 publisher -> PINGREQ (0)
20160218 121406.005 3 publisher <- PINGRESP
20160218 121417.017 3 publisher -> PINGREQ (0)
20160218 121417.120 3 publisher <- PINGRESP
20160218 121428.131 3 publisher -> PINGREQ (0)
20160218 121429.236 3 publisher <- PINGRESP
This is what happens when the keepalive interval is set to
10.
Ian
On 02/18/2016 12:07 PM, Joseph Harte
wrote:
Hello,
I’m developing a
MQTT client using the C version 1.0.3 for a linux
platform. I noticed that my broker does not receive any
PINGREQS from the client so the broker disconnects the
client. Does the client need to manually send the
message, or is there a way to ‘turn on’ this feature
that I’ve missed.
This is the printout
from my broker.
20160218
115220.284152: C 20.27 to S: Connects(DUP=False, QoS=0,
Retain=False, ProtocolName=MQTT, ProtocolVersion=4,
CleanSession=True, WillFlag=False, KeepAliveTimer=10,
ClientId=20.27, usernameFlag=False, passwordFlag=False)
Hex: ['0x10',
'0x11', '0x0', '0x4', '0x4d', '0x51', '0x54', '0x54',
'0x4', '0x2', '0x0', '0xa', '0x0', '0x5', '0x32',
'0x30', '0x2e', '0x32', '0x37']
String:
b'\x10\x11\x00\x04MQTT\x04\x02\x00\n\x00\x0520..27'
20160218
115220.287514: S to C 20.27: Connacks(DUP=False, QoS=0,
Retain=False, Session present=False, ReturnCode=0)
Hex: ['0x20',
'0x2', '0x0', '0x0']
String: b'
\x02\x00\x00'
20160218
115235.314276 client 20.27 connection closing
Kind Regards,
Joe Harte
B+B
SmartWorx has become Advantech B+B SmartWorx. To learn
more, visit: http://advantech-bb.com/company/
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
--
Ian Craggs
icraggs@xxxxxxxxxx IBM United Kingdom
Paho Project Lead; Committer on Mosquitto
B+B
SmartWorx has become Advantech B+B SmartWorx.. To learn
more, visit: http://advantech-bb.com/company/
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev