[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [mosquitto-dev] mosquitto_sub with binary payload
|
Thanks for the replies
Greg Troxel
-----------
You are clearly correct. After some more research it seems that on Windows stdout is always
opened in text mode by the OS. fwrite() therefore prepends /r to /n
It is possible to change it using a MS specific call _setmode(_fileno(stdout), O_BINARY) which
would have to be inserted between some #ifdef WIN32 #endif lines
Given the documentation, it would seem reasonable to expect this to be done when specifying
-F %p
which is supposed to give binary, control characters and all.
I just don't have the confidence to have a bash at fixing it. I'd have to be certain I
understood which bit goes where and compile from source on Windows.
Kees Nuyt
---------
Good point about ctrl Z. Actually, it does not seem to cause the pipe to stop, but it was
definitely worth checking.
There are certainly work-arounds. The easiest would be to write my own simple subscribing
client. However, I am trying to convince collaborators to have a go at looking at my MQTT
output and I am trying to keep it as simple as possible for them, because, frankly, they are a
bit feeble. It would be nice to be able to say "Look just use this free utility and then
examine the file". If they want to start with encryption and security, they can, without me
immediately having to do a load more work. The decoupling of publisher and subscriber is one
of the things I like about MQTT.
I am actually mostly sending text, although sometimes in Chinese! The problem is that I need
to send a multiline message. I am uncomfortable with the payload changing according to which
subscribing client is used. I started out publishing /r /n, because I knew they are Windows
based. When I tested with mosquitto_sub I ended up with every line /r /r /n.
Anyway, I think you guys have answered my question, so thanks.
--
Steve Mullock